private void clearCache(Collection<String> addresses) { for (String pjid : addresses) { /* * TODO We should remove all presences kept for the given * addresses */ for (Presence presence : rosterTracker.getPresences(new JID(pjid))) { clearCache(presence); } } }
/** * Returns the RQ-JID of given plain JID supporting the feature of the given name-space if * available, otherwise null. * * <p>If not in the cache then a blocking cache update is performed. * * @param jid The JID of the user to find a supporting presence for. The JID can be resource * qualified in which case the resource is stripped, before performing the look-up. * @blocking This method blocks until the ServiceDiscovery returns. * @reentrant This method can be called concurrently. * @caching If results are available in the cache, they are used instead of querying the server. */ public JID getSupportingPresence(final JID jid, final String namespace) { checkJID(jid); for (Presence presence : rosterTracker.getPresences(jid.getBareJID())) { if (!presence.isAvailable()) continue; String rjid = presence.getFrom(); if (rjid == null) { LOG.error("presence.getFrom() is null"); continue; } JID jidToCheck = new JID(rjid); Boolean supported = queryFeatureSupport(jidToCheck, namespace); if (supported != null && supported) return jidToCheck; } return null; }