From 127557df5688bdb6b02247eac2d116f447c070c3 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Mon, 18 Dec 2017 13:47:53 +0100 Subject: [PATCH] show pep as available if omemo_all_access has been installed on server --- .../conversations/crypto/axolotl/AxolotlService.java | 1 + .../eu/siacs/conversations/ui/EditAccountActivity.java | 2 +- .../eu/siacs/conversations/xmpp/XmppConnection.java | 10 ++++++---- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java b/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java index afb10b01a..d8574beef 100644 --- a/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java +++ b/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java @@ -63,6 +63,7 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded { public static final String PEP_DEVICE_LIST_NOTIFY = PEP_DEVICE_LIST + "+notify"; public static final String PEP_BUNDLES = PEP_PREFIX + ".bundles"; public static final String PEP_VERIFICATION = PEP_PREFIX + ".verification"; + public static final String PEP_OMEMO_WHITELISTED = PEP_PREFIX + ".whitelisted"; public static final String LOGPREFIX = "AxolotlService"; diff --git a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java index 61932b236..35feeb7e3 100644 --- a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java @@ -913,7 +913,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat AxolotlService axolotlService = this.mAccount.getAxolotlService(); if (axolotlService != null && axolotlService.isPepBroken()) { this.mServerInfoPep.setText(R.string.server_info_broken); - } else if (features.pepPublishOptions()) { + } else if (features.pepPublishOptions() || features.pepOmemoWhitelisted()) { this.mServerInfoPep.setText(R.string.server_info_available); } else { this.mServerInfoPep.setText(R.string.server_info_partial); diff --git a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java index e642dc816..12f601a0c 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java @@ -53,6 +53,7 @@ import de.duenndns.ssl.DomainHostnameVerifier; import de.duenndns.ssl.MemorizingTrustManager; import eu.siacs.conversations.Config; import eu.siacs.conversations.crypto.XmppDomainVerifier; +import eu.siacs.conversations.crypto.axolotl.AxolotlService; import eu.siacs.conversations.crypto.sasl.Anonymous; import eu.siacs.conversations.crypto.sasl.DigestMd5; import eu.siacs.conversations.crypto.sasl.External; @@ -1708,10 +1709,11 @@ public class XmppConnection implements Runnable { } public boolean pepPublishOptions() { - synchronized (XmppConnection.this.disco) { - ServiceDiscoveryResult info = disco.get(account.getJid().toBareJid()); - return info != null && info.getFeatures().contains(Namespace.PUBSUB_PUBLISH_OPTIONS); - } + return hasDiscoFeature(account.getJid().toBareJid(),Namespace.PUBSUB_PUBLISH_OPTIONS); + } + + public boolean pepOmemoWhitelisted() { + return hasDiscoFeature(account.getJid().toBareJid(), AxolotlService.PEP_OMEMO_WHITELISTED); } public boolean mam() {