当前位置: 首页>>代码示例>>Java>>正文


Java DiscoverItems.Item方法代码示例

本文整理汇总了Java中org.jivesoftware.smackx.packet.DiscoverItems.Item方法的典型用法代码示例。如果您正苦于以下问题:Java DiscoverItems.Item方法的具体用法?Java DiscoverItems.Item怎么用?Java DiscoverItems.Item使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jivesoftware.smackx.packet.DiscoverItems的用法示例。


在下文中一共展示了DiscoverItems.Item方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: process

import org.jivesoftware.smackx.packet.DiscoverItems; //导入方法依赖的package包/类
public void process(Packet packet) {
  if (roomResponseFilter.accept(packet)) {
    final DiscoverItems result = (DiscoverItems) packet;
    final JabberPlayer player = playerMgr.getPlayer(packet.getFrom());
    // Collect the entityID for each returned item
    for (Iterator<DiscoverItems.Item> items = result.getItems(); items.hasNext();) {
      final String roomJID = items.next().getEntityID();
      final JabberRoom room = roomMgr.getRoomByJID(JabberClient.this, roomJID);
      try {
       room.setInfo(MultiUserChat.getRoomInfo(JabberClient.this
            .getConnection(), roomJID));
      }
      catch (XMPPException e) {
        // Ignore Error
      }
      if (!roomJID.equals(monitorRoom.getRoom())) {
        player.join(roomMgr.getRoomByJID(JabberClient.this, roomJID));
      }
    }
    fireRoomsUpdated();
  }
  else if (newPlayerFilter.accept(packet)) {
    sendRoomQuery(getAbsolutePlayerJID(packet.getFrom()));
  }
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:26,代码来源:JabberClient.java

示例2: publishCommands

import org.jivesoftware.smackx.packet.DiscoverItems; //导入方法依赖的package包/类
/**
 * Publish the commands to an specific JID.
 *
 * @param jid the full JID to publish the commands to.
 * @throws XMPPException if the operation failed for some reason.
 */
public void publishCommands(String jid) throws XMPPException {
    ServiceDiscoveryManager serviceDiscoveryManager = ServiceDiscoveryManager
            .getInstanceFor(connection);

    // Collects the commands to publish as items
    DiscoverItems discoverItems = new DiscoverItems();
    Collection<AdHocCommandInfo> xCommandsList = getRegisteredCommands();

    for (AdHocCommandInfo info : xCommandsList) {
        DiscoverItems.Item item = new DiscoverItems.Item(info.getOwnerJID());
        item.setName(info.getName());
        item.setNode(info.getNode());
        discoverItems.addItem(item);
    }

    serviceDiscoveryManager.publishItems(jid, discoNode, discoverItems);
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:24,代码来源:AdHocCommandManager.java

示例3: getJoinedRooms

import org.jivesoftware.smackx.packet.DiscoverItems; //导入方法依赖的package包/类
/**
 * Returns an Iterator on the rooms where the requested user has joined. The Iterator will
 * contain Strings where each String represents a room (e.g. [email protected]).
 *
 * @param connection the connection to use to perform the service discovery.
 * @param user the user to check. A fully qualified xmpp ID, e.g. [email protected]
 * @return an Iterator on the rooms where the requested user has joined.
 */
public static Iterator<String> getJoinedRooms(Connection connection, String user) {
    try {
        ArrayList<String> answer = new ArrayList<String>();
        // Send the disco packet to the user
        DiscoverItems result =
            ServiceDiscoveryManager.getInstanceFor(connection).discoverItems(user, discoNode);
        // Collect the entityID for each returned item
        for (Iterator<DiscoverItems.Item> items=result.getItems(); items.hasNext();) {
            answer.add(items.next().getEntityID());
        }
        return answer.iterator();
    }
    catch (XMPPException e) {
        e.printStackTrace();
        // Return an iterator on an empty collection
        return new ArrayList<String>().iterator();
    }
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:27,代码来源:MultiUserChat.java

示例4: getServiceNames

import org.jivesoftware.smackx.packet.DiscoverItems; //导入方法依赖的package包/类
/**
 * Returns a collection with the XMPP addresses of the Multi-User Chat services.
 *
 * @param connection the XMPP connection to use for discovering Multi-User Chat services.
 * @return a collection with the XMPP addresses of the Multi-User Chat services.
 * @throws XMPPException if an error occured while trying to discover MUC services.
 */
public static Collection<String> getServiceNames(Connection connection) throws XMPPException {
    final List<String> answer = new ArrayList<String>();
    ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(connection);
    DiscoverItems items = discoManager.discoverItems(connection.getServiceName());
    for (Iterator<DiscoverItems.Item> it = items.getItems(); it.hasNext();) {
        DiscoverItems.Item item = it.next();
        try {
            DiscoverInfo info = discoManager.discoverInfo(item.getEntityID());
            if (info.containsFeature("http://jabber.org/protocol/muc")) {
                answer.add(item.getEntityID());
            }
        }
        catch (XMPPException e) {
            // Trouble finding info in some cases. This is a workaround for
            // discovering info on remote servers.
        }
    }
    return answer;
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:27,代码来源:MultiUserChat.java

示例5: publishCommands

import org.jivesoftware.smackx.packet.DiscoverItems; //导入方法依赖的package包/类
/**
 * Publish the commands to an specific JID.
 * 
 * @param jid
 *            the full JID to publish the commands to.
 * @throws XMPPException
 *             if the operation failed for some reason.
 */
public void publishCommands(String jid) throws XMPPException {
	ServiceDiscoveryManager serviceDiscoveryManager = ServiceDiscoveryManager
			.getInstanceFor(connection);

	// Collects the commands to publish as items
	DiscoverItems discoverItems = new DiscoverItems();
	Collection<AdHocCommandInfo> xCommandsList = getRegisteredCommands();

	for (AdHocCommandInfo info : xCommandsList) {
		DiscoverItems.Item item = new DiscoverItems.Item(info.getOwnerJID());
		item.setName(info.getName());
		item.setNode(info.getNode());
		discoverItems.addItem(item);
	}

	serviceDiscoveryManager.publishItems(jid, discoNode, discoverItems);
}
 
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:26,代码来源:AdHocCommandManager.java

示例6: getJoinedRooms

import org.jivesoftware.smackx.packet.DiscoverItems; //导入方法依赖的package包/类
/**
 * Returns an Iterator on the rooms where the requested user has joined. The
 * Iterator will contain Strings where each String represents a room (e.g.
 * [email protected]).
 * 
 * @param connection
 *            the connection to use to perform the service discovery.
 * @param user
 *            the user to check. A fully qualified xmpp ID, e.g.
 *            [email protected]
 * @return an Iterator on the rooms where the requested user has joined.
 */
public static Iterator<String> getJoinedRooms(Connection connection,
		String user) {
	try {
		ArrayList<String> answer = new ArrayList<String>();
		// Send the disco packet to the user
		DiscoverItems result = ServiceDiscoveryManager.getInstanceFor(
				connection).discoverItems(user, discoNode);
		// Collect the entityID for each returned item
		for (Iterator<DiscoverItems.Item> items = result.getItems(); items
				.hasNext();) {
			answer.add(items.next().getEntityID());
		}
		return answer.iterator();
	} catch (XMPPException e) {
		e.printStackTrace();
		// Return an iterator on an empty collection
		return new ArrayList<String>().iterator();
	}
}
 
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:32,代码来源:MultiUserChat.java

示例7: getServiceNames

import org.jivesoftware.smackx.packet.DiscoverItems; //导入方法依赖的package包/类
/**
 * Returns a collection with the XMPP addresses of the Multi-User Chat
 * services.
 * 
 * @param connection
 *            the XMPP connection to use for discovering Multi-User Chat
 *            services.
 * @return a collection with the XMPP addresses of the Multi-User Chat
 *         services.
 * @throws XMPPException
 *             if an error occured while trying to discover MUC services.
 */
public static Collection<String> getServiceNames(Connection connection)
		throws XMPPException {
	final List<String> answer = new ArrayList<String>();
	ServiceDiscoveryManager discoManager = ServiceDiscoveryManager
			.getInstanceFor(connection);
	DiscoverItems items = discoManager.discoverItems(connection
			.getServiceName());
	for (Iterator<DiscoverItems.Item> it = items.getItems(); it.hasNext();) {
		DiscoverItems.Item item = it.next();
		try {
			DiscoverInfo info = discoManager.discoverInfo(item
					.getEntityID());
			if (info.containsFeature("http://jabber.org/protocol/muc")) {
				answer.add(item.getEntityID());
			}
		} catch (XMPPException e) {
			// Trouble finding info in some cases. This is a workaround for
			// discovering info on remote servers.
		}
	}
	return answer;
}
 
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:35,代码来源:MultiUserChat.java

示例8: checkIsProxy

import org.jivesoftware.smackx.packet.DiscoverItems; //导入方法依赖的package包/类
/**
 * Checks the service discovery item returned from a server component to verify if it is
 * a File Transfer proxy or not.
 *
 * @param manager the service discovery manager which will be used to query the component
 * @param item    the discovered item on the server relating
 * @return returns the JID of the proxy if it is a proxy or null if the item is not a proxy.
 */
private String checkIsProxy(ServiceDiscoveryManager manager, DiscoverItems.Item item) {
    DiscoverInfo info;
    try {
        info = manager.discoverInfo(item.getEntityID());
    }
    catch (XMPPException e) {
        return null;
    }
    Iterator<DiscoverInfo.Identity> itx = info.getIdentities();
    while (itx.hasNext()) {
        DiscoverInfo.Identity identity = itx.next();
        if ("proxy".equalsIgnoreCase(identity.getCategory())
                && "bytestreams".equalsIgnoreCase(
                identity.getType())) {
            return info.getFrom();
        }
    }
    return null;
}
 
开发者ID:phoenixNirvana,项目名称:NewCommunication-Android,代码行数:28,代码来源:Socks5TransferNegotiatorManager.java

示例9: isSoftPhonePluginInstalled

import org.jivesoftware.smackx.packet.DiscoverItems; //导入方法依赖的package包/类
/**
 * Does a service discovery on the server to see if a SIPpark Manager is
 * enabled.
 *
 * @param con the XMPPConnection to use.
 * @return true if SIPpark Manager is available.
 */
public static boolean isSoftPhonePluginInstalled(XMPPConnection con) {
    if (!con.isConnected()) {
        return false;
    }

    ServiceDiscoveryManager disco = ServiceDiscoveryManager
            .getInstanceFor(con);
    try {
        DiscoverItems items = disco.discoverItems(con.getServiceName());
        Iterator<DiscoverItems.Item> iter = items.getItems();
        while (iter.hasNext()) {
            DiscoverItems.Item item = iter.next();
            if ("SIP Controller".equals(item.getName())) {
                Log.debug("SIP Controller Found");
                return true;
            }
        }
    }
    catch (XMPPException e) {
        Log.error("isSparkPluginInstalled", e);
    }

    return false;

}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:33,代码来源:SipAccountPacket.java

示例10: getConferenceServices

import org.jivesoftware.smackx.packet.DiscoverItems; //导入方法依赖的package包/类
private Collection<String> getConferenceServices(String server) throws Exception {
    List<String> answer = new ArrayList<String>();
    ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(SparkManager.getConnection());
    DiscoverItems items = discoManager.discoverItems(server);
    for (Iterator<DiscoverItems.Item> it = items.getItems(); it.hasNext();) {
        DiscoverItems.Item item = (DiscoverItems.Item)it.next();
        if (item.getEntityID().startsWith("conference") || item.getEntityID().startsWith("private")) {
            answer.add(item.getEntityID());
        }
        else {
            try {
                DiscoverInfo info = discoManager.discoverInfo(item.getEntityID());
                if (info.containsFeature("http://jabber.org/protocol/muc")) {
                    answer.add(item.getEntityID());
                }
            }
            catch (XMPPException e) {
                Log.error("Problem when loading conference service.", e);
            }
        }
    }
    return answer;
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:24,代码来源:BookmarksUI.java

示例11: testDiscoverNodeItems

import org.jivesoftware.smackx.packet.DiscoverItems; //导入方法依赖的package包/类
public void testDiscoverNodeItems() throws Exception
{
	LeafNode myNode = getRandomPubnode(getManager(), true, false);
	myNode.send(new Item());
	myNode.send(new Item());
	myNode.send(new Item());
	myNode.send(new Item());
	DiscoverItems items = myNode.discoverItems();
	
	int count = 0;
	
	for(Iterator<DiscoverItems.Item> it = items.getItems(); it.hasNext(); it.next(),count++);
	
	assertEquals(4, count);
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:16,代码来源:EntityUseCases.java

示例12: getHostedRooms

import org.jivesoftware.smackx.packet.DiscoverItems; //导入方法依赖的package包/类
/**
 * Returns a collection of HostedRooms where each HostedRoom has the XMPP address of the room
 * and the room's name. Once discovered the rooms hosted by a chat service it is possible to
 * discover more detailed room information or join the room.
 *
 * @param connection the XMPP connection to use for discovering hosted rooms by the MUC service.
 * @param serviceName the service that is hosting the rooms to discover.
 * @return a collection of HostedRooms.
 * @throws XMPPException if an error occured while trying to discover the information.
 */
public static Collection<HostedRoom> getHostedRooms(Connection connection, String serviceName)
        throws XMPPException {
    List<HostedRoom> answer = new ArrayList<HostedRoom>();
    ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(connection);
    DiscoverItems items = discoManager.discoverItems(serviceName);
    for (Iterator<DiscoverItems.Item> it = items.getItems(); it.hasNext();) {
        answer.add(new HostedRoom(it.next()));
    }
    return answer;
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:21,代码来源:MultiUserChat.java

示例13: getHeaders

import org.jivesoftware.smackx.packet.DiscoverItems; //导入方法依赖的package包/类
/**
 * Returns an iterator on <tt>OfflineMessageHeader</tt> that keep information about the
 * offline message. The OfflineMessageHeader includes a stamp that could be used to retrieve
 * the complete message or delete the specific message.
 *
 * @return an iterator on <tt>OfflineMessageHeader</tt> that keep information about the offline
 *         message.
 * @throws XMPPException If the user is not allowed to make this request or the server does
 *                       not support offline message retrieval.
 */
public Iterator<OfflineMessageHeader> getHeaders() throws XMPPException {
    List<OfflineMessageHeader> answer = new ArrayList<OfflineMessageHeader>();
    DiscoverItems items = ServiceDiscoveryManager.getInstanceFor(connection).discoverItems(
            null, namespace);
    for (Iterator it = items.getItems(); it.hasNext();) {
        DiscoverItems.Item item = (DiscoverItems.Item) it.next();
        answer.add(new OfflineMessageHeader(item));
    }
    return answer.iterator();
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:21,代码来源:OfflineMessageManager.java

示例14: publishCommands

import org.jivesoftware.smackx.packet.DiscoverItems; //导入方法依赖的package包/类
/**
 * Publish the commands to an specific JID.
 *
 * @param jid the full JID to publish the commands to.
 * @throws XMPPException if the operation failed for some reason.
 */
public void publishCommands(String jid) throws XMPPException {
    // Collects the commands to publish as items
    DiscoverItems discoverItems = new DiscoverItems();
    Collection<AdHocCommandInfo> xCommandsList = getRegisteredCommands();

    for (AdHocCommandInfo info : xCommandsList) {
        DiscoverItems.Item item = new DiscoverItems.Item(info.getOwnerJID());
        item.setName(info.getName());
        item.setNode(info.getNode());
        discoverItems.addItem(item);
    }

    serviceDiscoveryManager.publishItems(jid, discoNode, discoverItems);
}
 
开发者ID:CJC-ivotten,项目名称:androidPN-client.,代码行数:21,代码来源:AdHocCommandManager.java

示例15: getHeaders

import org.jivesoftware.smackx.packet.DiscoverItems; //导入方法依赖的package包/类
/**
 * Returns an iterator on <tt>OfflineMessageHeader</tt> that keep information about the
 * offline message. The OfflineMessageHeader includes a stamp that could be used to retrieve
 * the complete message or delete the specific message.
 *
 * @return an iterator on <tt>OfflineMessageHeader</tt> that keep information about the offline
 *         message.
 * @throws XMPPException If the user is not allowed to make this request or the server does
 *                       not support offline message retrieval.
 */
public Iterator<OfflineMessageHeader> getHeaders() throws XMPPException {
    List<OfflineMessageHeader> answer = new ArrayList<OfflineMessageHeader>();
    DiscoverItems items = ServiceDiscoveryManager.getInstanceFor(connection).discoverItems(
            null, namespace);
    for (Iterator<DiscoverItems.Item> it = items.getItems(); it.hasNext();) {
        DiscoverItems.Item item = it.next();
        answer.add(new OfflineMessageHeader(item));
    }
    return answer.iterator();
}
 
开发者ID:CJC-ivotten,项目名称:androidPN-client.,代码行数:21,代码来源:OfflineMessageManager.java


注:本文中的org.jivesoftware.smackx.packet.DiscoverItems.Item方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。