1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-22 14:22:05 +01:00

Use ServiceDiscoveryManager.supportsFeature() in AMPManager

This commit is contained in:
Florian Schmaus 2014-10-31 18:01:42 +01:00
parent c1aef37081
commit 5fb17dc85f

View file

@ -24,7 +24,6 @@ import org.jivesoftware.smack.XMPPConnectionRegistry;
import org.jivesoftware.smack.XMPPException.XMPPErrorException; import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smackx.amp.packet.AMPExtension; import org.jivesoftware.smackx.amp.packet.AMPExtension;
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
/** /**
* Manages AMP stanzas within messages. A AMPManager provides a high level access to * Manages AMP stanzas within messages. A AMPManager provides a high level access to
@ -111,13 +110,6 @@ public class AMPManager {
} }
private static boolean isFeatureSupportedByServer(XMPPConnection connection, String featureName, String node) throws NoResponseException, XMPPErrorException, NotConnectedException { private static boolean isFeatureSupportedByServer(XMPPConnection connection, String featureName, String node) throws NoResponseException, XMPPErrorException, NotConnectedException {
ServiceDiscoveryManager discoveryManager = ServiceDiscoveryManager.getInstanceFor(connection); return ServiceDiscoveryManager.getInstanceFor(connection).supportsFeature(node, featureName);
DiscoverInfo info = discoveryManager.discoverInfo(connection.getServiceName(), node);
for (DiscoverInfo.Feature feature : info.getFeatures()){
if (featureName.equals(feature.getVar())) {
return true;
}
}
return false;
} }
} }