/** Entity Capabilities */ public void setEntityCapsManager(EntityCapsManager manager) { capsManager = manager; if (connection.getCapsNode() != null && connection.getHost() != null) { capsManager.addUserCapsNode(connection.getHost(), connection.getCapsNode()); } capsManager.addPacketListener(connection); }
/** * Perform a ServiceDiscovery [1] and check if the given resource is among the features supported * by the given recipient. * * <p>[1] XEP-0030 http://xmpp.org/extensions/xep-0030.html * * @param jid The JID must have a resource identifier (user@host/resource), otherwise you get a * blame StackTrace in your logs. * @return DiscoverInfo from recipient or null if an XMPPException was thrown. * @blocking This method blocks until the ServiceDiscovery returns. * @reentrant This method can be called concurrently. * @nonCaching This method does not use a cache, but queries the server directly. */ private DiscoverInfo performServiceDiscovery(final JID jid) { if (jid.isBareJID()) { LOG.warn( "cannot perform service discovery on a non resource qualified jid: " + jid.toString(), new StackTrace()); return null; } final Connection connection = connectionService.getConnection(); if (connection == null) { LOG.warn("cannot not perform a service discovery because not connected to a XMPP server"); return null; } ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection); try { return sdm.discoverInfo(jid.toString()); } catch (XMPPException e) { LOG.warn( "Service Discovery failed on recipient " + jid.toString() + " server: " + connection.getHost(), e); /* * FIXME handle timeouts and error conditions differently ! see * http://xmpp.org/extensions/xep-0030.html#errors */ return null; } }