/** * Returns the discovered information of a given XMPP entity addressed by its JID. Use null as * entityID to query the server * * @param entityID the address of the XMPP entity or null. * @return the discovered information. * @throws XMPPException if the operation failed for some reason. */ public DiscoverInfo discoverInfo(String entityID) throws XMPPException { if (entityID == null) return discoverInfo(null, null); // Check if the have it cached in the Entity Capabilities Manager DiscoverInfo info = EntityCapsManager.getDiscoverInfoByUser(entityID); if (info != null) { // We were able to retrieve the information from Entity Caps and // avoided a disco request, hurray! return info; } // Try to get the newest node#version if it's known, otherwise null is // returned EntityCapsManager.NodeVerHash nvh = EntityCapsManager.getNodeVerHashByJid(entityID); // Discover by requesting the information from the remote entity // Note that wee need to use NodeVer as argument for Node if it exists info = discoverInfo(entityID, nvh != null ? nvh.getNodeVer() : null); // If the node version is known, store the new entry. if (nvh != null) { if (EntityCapsManager.verifyDiscoverInfoVersion(nvh.getVer(), nvh.getHash(), info)) EntityCapsManager.addDiscoverInfoByNode(nvh.getNodeVer(), info); } return info; }
/** Updates the Entity Capabilities Verification String if EntityCaps is enabled */ private void renewEntityCapsVersion() { if (capsManager != null && capsManager.entityCapsEnabled()) capsManager.updateLocalEntityCaps(); }