mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-23 20:42:06 +01:00
Fix serverSupportsSecretKeyBackups method
This commit is contained in:
parent
dc79a09240
commit
e87ea6c8f4
3 changed files with 6 additions and 9 deletions
|
@ -50,7 +50,7 @@ public class SecretKeyBackupRestoreIntegrationTest extends AbstractOpenPgpIntegr
|
||||||
throws XMPPException.XMPPErrorException, TestNotPossibleException, SmackException.NotConnectedException,
|
throws XMPPException.XMPPErrorException, TestNotPossibleException, SmackException.NotConnectedException,
|
||||||
InterruptedException, SmackException.NoResponseException, SmackException.NotLoggedInException {
|
InterruptedException, SmackException.NoResponseException, SmackException.NotLoggedInException {
|
||||||
super(environment);
|
super(environment);
|
||||||
if (!OpenPgpManager.serverSupportsSecretKeyBackups(aliceConnection, aliceConnection.getXMPPServiceDomain())) {
|
if (!OpenPgpManager.serverSupportsSecretKeyBackups(aliceConnection)) {
|
||||||
throw new TestNotPossibleException("Server does not support the whitelist access model.");
|
throw new TestNotPossibleException("Server does not support the whitelist access model.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,10 +78,8 @@ import org.jivesoftware.smackx.pubsub.LeafNode;
|
||||||
import org.jivesoftware.smackx.pubsub.PayloadItem;
|
import org.jivesoftware.smackx.pubsub.PayloadItem;
|
||||||
import org.jivesoftware.smackx.pubsub.PubSubException;
|
import org.jivesoftware.smackx.pubsub.PubSubException;
|
||||||
import org.jivesoftware.smackx.pubsub.PubSubFeature;
|
import org.jivesoftware.smackx.pubsub.PubSubFeature;
|
||||||
import org.jivesoftware.smackx.pubsub.PubSubManager;
|
|
||||||
|
|
||||||
import org.jxmpp.jid.BareJid;
|
import org.jxmpp.jid.BareJid;
|
||||||
import org.jxmpp.jid.DomainBareJid;
|
|
||||||
import org.jxmpp.jid.EntityBareJid;
|
import org.jxmpp.jid.EntityBareJid;
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
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>
|
* @see <a href="https://xmpp.org/extensions/xep-0373.html#synchro-pep">XEP-0373 §5</a>
|
||||||
*
|
*
|
||||||
* @param connection
|
* @param connection
|
||||||
* @param server Servers {@link DomainBareJid}
|
|
||||||
* @return true, if the server supports secret key backups, otherwise false.
|
* @return true, if the server supports secret key backups, otherwise false.
|
||||||
* @throws XMPPException.XMPPErrorException
|
* @throws XMPPException.XMPPErrorException
|
||||||
* @throws SmackException.NotConnectedException
|
* @throws SmackException.NotConnectedException
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
* @throws SmackException.NoResponseException
|
* @throws SmackException.NoResponseException
|
||||||
*/
|
*/
|
||||||
public static boolean serverSupportsSecretKeyBackups(XMPPConnection connection, DomainBareJid server)
|
public static boolean serverSupportsSecretKeyBackups(XMPPConnection connection)
|
||||||
throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException,
|
throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException,
|
||||||
SmackException.NoResponseException, SmackException.NotLoggedInException {
|
SmackException.NoResponseException {
|
||||||
return PubSubManager.getInstance(connection, server).getSupportedFeatures()
|
return ServiceDiscoveryManager.getInstanceFor(connection)
|
||||||
.containsFeature(PubSubFeature.access_whitelist.getFeatureName());
|
.serverSupportsFeature(PubSubFeature.access_whitelist.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -299,7 +299,7 @@ public class PubSubDelegate {
|
||||||
throws InterruptedException, PubSubException.NotALeafNodeException,
|
throws InterruptedException, PubSubException.NotALeafNodeException,
|
||||||
XMPPException.XMPPErrorException, SmackException.NotConnectedException, SmackException.NoResponseException,
|
XMPPException.XMPPErrorException, SmackException.NotConnectedException, SmackException.NoResponseException,
|
||||||
SmackException.NotLoggedInException, SmackException.FeatureNotSupportedException {
|
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");
|
throw new SmackException.FeatureNotSupportedException("http://jabber.org/protocol/pubsub#access-whitelist");
|
||||||
}
|
}
|
||||||
PubSubManager pm = PubSubManager.getInstance(connection);
|
PubSubManager pm = PubSubManager.getInstance(connection);
|
||||||
|
|
Loading…
Reference in a new issue