From 2065a7ed013742fc9cdced5d8dc8c59933c0c946 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Mon, 23 Apr 2018 20:41:33 +0200 Subject: [PATCH] Add findServicesDiscoverInfo() with service argument to ServiceDiscoveryManager. --- .../smackx/disco/ServiceDiscoveryManager.java | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/ServiceDiscoveryManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/ServiceDiscoveryManager.java index aeee98e8f..963076be5 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/ServiceDiscoveryManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/ServiceDiscoveryManager.java @@ -793,8 +793,29 @@ public final class ServiceDiscoveryManager extends Manager { */ public List findServicesDiscoverInfo(String feature, boolean stopOnFirst, boolean useCache, Map encounteredExceptions) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { - List serviceDiscoInfo; DomainBareJid serviceName = connection().getXMPPServiceDomain(); + return findServicesDiscoverInfo(serviceName, feature, stopOnFirst, useCache, encounteredExceptions); + } + + /** + * Find all services under a given service that provide a given feature. + * + * @param serviceName the service to query + * @param feature the feature to search for + * @param stopOnFirst if true, stop searching after the first service was found + * @param useCache if true, query a cache first to avoid network I/O + * @param encounteredExceptions an optional map which will be filled with the exceptions encountered + * @return a possible empty list of services providing the given feature + * @throws NoResponseException + * @throws XMPPErrorException + * @throws NotConnectedException + * @throws InterruptedException + * @since 4.3.0 + */ + public List findServicesDiscoverInfo(DomainBareJid serviceName, String feature, boolean stopOnFirst, + boolean useCache, Map encounteredExceptions) + throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { + List serviceDiscoInfo; if (useCache) { serviceDiscoInfo = services.lookup(feature); if (serviceDiscoInfo != null) {