diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/openpgp/SecretKeyBackupRestoreIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/openpgp/SecretKeyBackupRestoreIntegrationTest.java index b724aa886..68362e88c 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/openpgp/SecretKeyBackupRestoreIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/openpgp/SecretKeyBackupRestoreIntegrationTest.java @@ -50,7 +50,7 @@ public class SecretKeyBackupRestoreIntegrationTest extends AbstractOpenPgpIntegr throws XMPPException.XMPPErrorException, TestNotPossibleException, SmackException.NotConnectedException, InterruptedException, SmackException.NoResponseException, SmackException.NotLoggedInException { super(environment); - if (!OpenPgpManager.serverSupportsSecretKeyBackups(aliceConnection, aliceConnection.getXMPPServiceDomain())) { + if (!OpenPgpManager.serverSupportsSecretKeyBackups(aliceConnection)) { throw new TestNotPossibleException("Server does not support the whitelist access model."); } } diff --git a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/OpenPgpManager.java b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/OpenPgpManager.java index c9b68e057..28b558c4d 100644 --- a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/OpenPgpManager.java +++ b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/OpenPgpManager.java @@ -78,10 +78,8 @@ import org.jivesoftware.smackx.pubsub.LeafNode; import org.jivesoftware.smackx.pubsub.PayloadItem; import org.jivesoftware.smackx.pubsub.PubSubException; import org.jivesoftware.smackx.pubsub.PubSubFeature; -import org.jivesoftware.smackx.pubsub.PubSubManager; import org.jxmpp.jid.BareJid; -import org.jxmpp.jid.DomainBareJid; import org.jxmpp.jid.EntityBareJid; import org.xmlpull.v1.XmlPullParserException; @@ -260,18 +258,17 @@ public final class OpenPgpManager extends Manager { * @see XEP-0373 ยง5 * * @param connection - * @param server Servers {@link DomainBareJid} * @return true, if the server supports secret key backups, otherwise false. * @throws XMPPException.XMPPErrorException * @throws SmackException.NotConnectedException * @throws InterruptedException * @throws SmackException.NoResponseException */ - public static boolean serverSupportsSecretKeyBackups(XMPPConnection connection, DomainBareJid server) + public static boolean serverSupportsSecretKeyBackups(XMPPConnection connection) throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException, - SmackException.NoResponseException, SmackException.NotLoggedInException { - return PubSubManager.getInstance(connection, server).getSupportedFeatures() - .containsFeature(PubSubFeature.access_whitelist.getFeatureName()); + SmackException.NoResponseException { + return ServiceDiscoveryManager.getInstanceFor(connection) + .serverSupportsFeature(PubSubFeature.access_whitelist.toString()); } /** diff --git a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/util/PubSubDelegate.java b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/util/PubSubDelegate.java index 4201257c5..483b49833 100644 --- a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/util/PubSubDelegate.java +++ b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/util/PubSubDelegate.java @@ -299,7 +299,7 @@ public class PubSubDelegate { throws InterruptedException, PubSubException.NotALeafNodeException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, SmackException.NoResponseException, SmackException.NotLoggedInException, SmackException.FeatureNotSupportedException { - if (!OpenPgpManager.serverSupportsSecretKeyBackups(connection, connection.getXMPPServiceDomain())) { + if (!OpenPgpManager.serverSupportsSecretKeyBackups(connection)) { throw new SmackException.FeatureNotSupportedException("http://jabber.org/protocol/pubsub#access-whitelist"); } PubSubManager pm = PubSubManager.getInstance(connection);