public static NodeVerHash getNodeVerHashByJid(Jid jid) { return JID_TO_NODEVER_CACHE.lookup(jid); }
/** * Get the Node version (node#ver) of a JID. Returns a String or null if * EntiyCapsManager does not have any information. * * @param jid * the user (Full JID) * @return the node version (node#ver) or null */ public static String getNodeVersionByJid(Jid jid) { NodeVerHash nvh = JID_TO_NODEVER_CACHE.lookup(jid); if (nvh != null) { return nvh.nodeVer; } else { return null; } }
/** * Retrieve the user presences (a map from resource to {@link Presence}) for a given XMPP entity represented by their bare JID. * * @param entity the entity * @return the user presences */ private Map<Resourcepart, Presence> getPresencesInternal(BareJid entity) { Map<Resourcepart, Presence> entityPresences = presenceMap.get(entity); if (entityPresences == null) { entityPresences = nonRosterPresenceMap.lookup(entity); } return entityPresences; }
/** * Get the discover info given a user name. The discover info is returned if * the user has a node#ver associated with it and the node#ver has a * discover info associated with it. * * @param user * user name (Full JID) * @return the discovered info */ public static DiscoverInfo getDiscoverInfoByUser(Jid user) { NodeVerHash nvh = JID_TO_NODEVER_CACHE.lookup(user); if (nvh == null) return null; return getDiscoveryInfoByNodeVer(nvh.nodeVer); }
@Override public IQ handleIQRequest(IQ iqRequest) { if (!isFromProvisioningService(iqRequest, true)) { return null; } ClearCache clearCache = (ClearCache) iqRequest; // Handle <clearCache/> request. Jid from = iqRequest.getFrom(); LruCache<BareJid, Void> cache = negativeFriendshipRequestCache.lookup(from); if (cache != null) { cache.clear(); } return new ClearCacheResponse(clearCache); } });
/** * Retrieve DiscoverInfo for a specific node. * * @param nodeVer * The node name (e.g. * "http://psi-im.org#q07IKJEyjvHSyhy//CH0CxmKi8w="). * @return The corresponding DiscoverInfo or null if none is known. */ public static DiscoverInfo getDiscoveryInfoByNodeVer(String nodeVer) { DiscoverInfo info = CAPS_CACHE.lookup(nodeVer); // If it was not in CAPS_CACHE, try to retrieve the information from persistentCache if (info == null && persistentCache != null) { info = persistentCache.lookup(nodeVer); // Promote the information to CAPS_CACHE if one was found if (info != null) { CAPS_CACHE.put(nodeVer, info); } } // If we were able to retrieve information from one of the caches, copy it before returning if (info != null) info = new DiscoverInfo(info); return info; }
/** * Request BoB data. * * @param to * @param bobHash * @return the BoB data * @throws NotLoggedInException * @throws NoResponseException * @throws XMPPErrorException * @throws NotConnectedException * @throws InterruptedException */ public BoBData requestBoB(Jid to, BoBHash bobHash) throws NotLoggedInException, NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { BoBData bobData = BOB_CACHE.lookup(bobHash); if (bobData != null) { return bobData; } BoBIQ requestBoBIQ = new BoBIQ(bobHash); requestBoBIQ.setType(Type.get); requestBoBIQ.setTo(to); XMPPConnection connection = getAuthenticatedConnectionOrThrow(); BoBIQ responseBoBIQ = connection.createStanzaCollectorAndSend(requestBoBIQ).nextResultOrThrow(); bobData = responseBoBIQ.getBoBData(); BOB_CACHE.put(bobHash, bobData); return bobData; }
LruCache<BareJid, Void> cache = negativeFriendshipRequestCache.lookup(provisioningServer); if (cache != null && cache.containsKey(friendInQuestion)) {
@SmackIntegrationTest public void testEntityCaps() throws XMPPException, InterruptedException, NoResponseException, NotConnectedException, TimeoutException { final String dummyFeature = getNewDummyFeature(); dropWholeEntityCapsCache(); performActionAndWaitUntilStanzaReceived(new Runnable() { @Override public void run() { sdmTwo.addFeature(dummyFeature); } }, connection, new AndFilter(PresenceTypeFilter.AVAILABLE, FromMatchesFilter.create(conTwo.getUser()))); waitUntilTrue(new Condition() { @Override public boolean evaluate() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { DiscoverInfo info = sdmOne.discoverInfo(conTwo.getUser()); return info.containsFeature(dummyFeature); } }); DiscoverInfo info = sdmOne.discoverInfo(conTwo.getUser()); String u1ver = EntityCapsManager.getNodeVersionByJid(conTwo.getUser()); assertNotNull(u1ver); DiscoverInfo entityInfo = EntityCapsManager.CAPS_CACHE.lookup(u1ver); assertNotNull(entityInfo); assertEquals(info.toXML(null), entityInfo.toXML(null)); }
/** * Retrieve the user presences (a map from resource to {@link Presence}) for a given XMPP entity represented by their bare JID. * * @param entity the entity * @return the user presences */ private Map<Resourcepart, Presence> getPresencesInternal(BareJid entity) { Map<Resourcepart, Presence> entityPresences = presenceMap.get(entity); if (entityPresences == null) { entityPresences = nonRosterPresenceMap.lookup(entity); } return entityPresences; }
return null; String res = LOCALPART_ESACPE_CACHE.lookup(localpart); if (res != null) { return res;
return null; String res = LOCALPART_UNESCAPE_CACHE.lookup(localpart); if (res != null) { return res;
@Override public IQ handleIQRequest(IQ iqRequest) { if (!isFromProvisioningService(iqRequest, true)) { return null; } ClearCache clearCache = (ClearCache) iqRequest; // Handle <clearCache/> request. Jid from = iqRequest.getFrom(); LruCache<BareJid, Void> cache = negativeFriendshipRequestCache.lookup(from); if (cache != null) { cache.clear(); } return new ClearCacheResponse(clearCache); } });
LruCache<BareJid, Void> cache = negativeFriendshipRequestCache.lookup(provisioningServer); if (cache != null && cache.containsKey(friendInQuestion)) {