diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-04-13 22:15:05 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-04-13 22:15:05 +0200 |
commit | 0f7f4bf5ed4bc8d07c333daf2c5c519dd0c7fdc9 (patch) | |
tree | b3179f920caf10fd326014a976b088de82581e52 /src/main/java/de/pixart/messenger/entities | |
parent | ed91b6b648116690ffcab8b0a0569c4e769ad519 (diff) |
add ruleset to disable omemo-by-default for certain providers
Diffstat (limited to 'src/main/java/de/pixart/messenger/entities')
-rw-r--r-- | src/main/java/de/pixart/messenger/entities/Conversation.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/main/java/de/pixart/messenger/entities/Conversation.java b/src/main/java/de/pixart/messenger/entities/Conversation.java index 3769cedf6..266e06e10 100644 --- a/src/main/java/de/pixart/messenger/entities/Conversation.java +++ b/src/main/java/de/pixart/messenger/entities/Conversation.java @@ -753,10 +753,9 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl if (!Config.supportOmemo() && !Config.supportOpenPgp() && !Config.supportOtr()) { return Message.ENCRYPTION_NONE; } - AxolotlService axolotlService = account.getAxolotlService(); if (contactJid.asBareJid().equals(Config.BUG_REPORTS)) { defaultEncryption = Message.ENCRYPTION_NONE; - } else if (axolotlService != null && axolotlService.isConversationAxolotlCapable(this)) { + } else if (suitableForOmemoByDefault(this)) { defaultEncryption = Message.ENCRYPTION_AXOLOTL; } else { defaultEncryption = Message.ENCRYPTION_NONE; @@ -772,6 +771,16 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl } } + private static boolean suitableForOmemoByDefault(final Conversation conversation) { + final String contact = conversation.getJid().getDomain(); + final String account = conversation.getAccount().getServer(); + if (Config.OMEMO_EXCEPTIONS.CONTACT_DOMAINS.contains(contact) || Config.OMEMO_EXCEPTIONS.ACCOUNT_DOMAINS.contains(account)) { + return false; + } + final AxolotlService axolotlService = conversation.getAccount().getAxolotlService(); + return axolotlService != null && axolotlService.isConversationAxolotlCapable(conversation); + } + public void setNextEncryption(int encryption) { this.setAttribute(ATTRIBUTE_NEXT_ENCRYPTION, String.valueOf(encryption)); } |