Fix serverSupportsSecretKeyBackups method

This commit is contained in:
Paul Schaub 2018-06-26 10:56:33 +02:00
parent dc79a09240
commit e87ea6c8f4
3 changed files with 6 additions and 9 deletions

View File

@ -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.");
}
}

View File

@ -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 <a href="https://xmpp.org/extensions/xep-0373.html#synchro-pep">XEP-0373 §5</a>
*
* @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());
}
/**

View File

@ -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);