/** * Returns the discovered items of a given XMPP entity addressed by its JID. * * @param entityID the address of the XMPP entity. * @return the discovered information. * @throws XMPPException if the operation failed for some reason. */ public DiscoverItems discoverItems(String entityID) throws XMPPException { return discoverItems(entityID, null); }
/** * Returns the discovered items of a given XMPP entity addressed by its JID. * * @param entityID the address of the XMPP entity. * @return the discovered information. * @throws XMPPException if the operation failed for some reason. */ public DiscoverItems discoverItems(String entityID) throws XMPPException { return discoverItems(entityID, null); }
/** * Returns the discovered items of a given XMPP entity addressed by its JID. * * @param entityID the address of the XMPP entity. * @return the discovered information. * @throws XMPPException if the operation failed for some reason. */ public DiscoverItems discoverItems(String entityID) throws XMPPException { return discoverItems(entityID, null); }
/** * Returns the discovered items of a given XMPP entity addressed by its JID. * * @param entityID the address of the XMPP entity. * @return the discovered information. * @throws XMPPException if the operation failed for some reason. */ public DiscoverItems discoverItems(String entityID) throws XMPPException { return discoverItems(entityID, null); }
/** * Discover the commands of an specific JID. The <code>jid</code> is a * full JID. * * @param jid the full JID to retrieve the commands for. * @return the discovered items. * @throws XMPPException if the operation failed for some reason. */ public DiscoverItems discoverCommands(String jid) throws XMPPException { ServiceDiscoveryManager serviceDiscoveryManager = ServiceDiscoveryManager .getInstanceFor(connection); return serviceDiscoveryManager.discoverItems(jid, discoNode); }
/** * Discover the commands of an specific JID. The <code>jid</code> is a * full JID. * * @param jid the full JID to retrieve the commands for. * @return the discovered items. * @throws XMPPException if the operation failed for some reason. */ public DiscoverItems discoverCommands(String jid) throws XMPPException { ServiceDiscoveryManager serviceDiscoveryManager = ServiceDiscoveryManager .getInstanceFor(connection); return serviceDiscoveryManager.discoverItems(jid, discoNode); }
/** * Discover the commands of an specific JID. The <code>jid</code> is a * full JID. * * @param jid the full JID to retrieve the commands for. * @return the discovered items. * @throws XMPPException if the operation failed for some reason. */ public DiscoverItems discoverCommands(String jid) throws XMPPException { ServiceDiscoveryManager serviceDiscoveryManager = ServiceDiscoveryManager .getInstanceFor(connection); return serviceDiscoveryManager.discoverItems(jid, discoNode); }
/** * 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(); }
/** * 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; }
/** * 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(); }
/** * 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(); }
/** * 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 getHeaders() throws XMPPException { List answer = new ArrayList(); 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(); }
/** * 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; }
/** * 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 getHostedRooms(XMPPConnection connection, String serviceName) throws XMPPException { List answer = new ArrayList(); ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(connection); DiscoverItems items = discoManager.discoverItems(serviceName); for (Iterator it = items.getItems(); it.hasNext();) { DiscoverItems.Item item = (DiscoverItems.Item) it.next(); answer.add(new HostedRoom(item)); } return answer; }
/** * 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; }
/** * Loads all gateways the users server offers * @throws XMPPException */ private void loadLocalGateways() throws XMPPException{ DiscoverItems items = sdManager.discoverItems(connection.getHost()); Iterator<Item> iter = items.getItems(); while(iter.hasNext()){ String itemJID = iter.next().getEntityID(); discoverGateway(itemJID); } }
/** * 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. room@muc.jabber.org). * * @param connection the connection to use to perform the service discovery. * @param user the user to check. A fully qualified xmpp ID, e.g. jdoe@example.com. * @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(); } }
private void initProxies() { proxies = new ArrayList<String>(); ServiceDiscoveryManager manager = ServiceDiscoveryManager .getInstanceFor(connection); try { DiscoverItems discoItems = manager.discoverItems(connection.getServiceName()); Iterator it = discoItems.getItems(); while (it.hasNext()) { DiscoverItems.Item item = (DiscoverItems.Item) it.next(); String proxy = checkIsProxy(manager, item); if (proxy != null) { proxies.add(proxy); } } } catch (XMPPException e) { return; } if (proxies.size() > 0) { initStreamHosts(); } }
/** * 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; }
/** * 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; }