mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-01 01:35:59 +01:00
Use ServiceDiscoveryManager.supportsFeature() in AMPManager
This commit is contained in:
parent
c1aef37081
commit
5fb17dc85f
1 changed files with 1 additions and 9 deletions
|
@ -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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue