diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-04-02 23:12:26 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-04-02 23:28:47 +0200 |
commit | 4572bc579715653848135d479fd7506a8ebf3e74 (patch) | |
tree | bd126df4f125396ce873470928ed4f95e09d44d4 /src/main | |
parent | 621217973065960e3347262f507d7c3b39326464 (diff) |
make omemo default
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/de/pixart/messenger/entities/Conversation.java | 43 |
1 files changed, 12 insertions, 31 deletions
diff --git a/src/main/java/de/pixart/messenger/entities/Conversation.java b/src/main/java/de/pixart/messenger/entities/Conversation.java index e4ec95f3b..c9bbbfca2 100644 --- a/src/main/java/de/pixart/messenger/entities/Conversation.java +++ b/src/main/java/de/pixart/messenger/entities/Conversation.java @@ -760,40 +760,21 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl } public int getNextEncryption() { - return fixAvailableEncryption(this.getIntAttribute(ATTRIBUTE_NEXT_ENCRYPTION, getDefaultEncryption())); - } - - private int fixAvailableEncryption(int selectedEncryption) { - switch (selectedEncryption) { - case Message.ENCRYPTION_NONE: - return Config.supportUnencrypted() ? selectedEncryption : getDefaultEncryption(); - case Message.ENCRYPTION_AXOLOTL: - return Config.supportOmemo() ? selectedEncryption : getDefaultEncryption(); - case Message.ENCRYPTION_OTR: - return Config.supportOtr() ? selectedEncryption : getDefaultEncryption(); - case Message.ENCRYPTION_PGP: - case Message.ENCRYPTION_DECRYPTED: - case Message.ENCRYPTION_DECRYPTION_FAILED: - return Config.supportOpenPgp() ? Message.ENCRYPTION_PGP : getDefaultEncryption(); - default: - return getDefaultEncryption(); - } - } - - private int getDefaultEncryption() { + final int defaultEncryption; AxolotlService axolotlService = account.getAxolotlService(); - if (Config.supportUnencrypted()) { - return Message.ENCRYPTION_NONE; - } else if (Config.supportOmemo() - && (axolotlService != null && axolotlService.isConversationAxolotlCapable(this) || !Config.multipleEncryptionChoices())) { - return Message.ENCRYPTION_AXOLOTL; - } else if (Config.supportOtr() && mode == MODE_SINGLE) { - return Message.ENCRYPTION_OTR; - } else if (Config.supportOpenPgp()) { - return Message.ENCRYPTION_PGP; + if (axolotlService != null && axolotlService.isConversationAxolotlCapable(this)) { + defaultEncryption = Message.ENCRYPTION_AXOLOTL; } else { - return Message.ENCRYPTION_NONE; + defaultEncryption = Message.ENCRYPTION_NONE; } + int encryption = this.getIntAttribute(ATTRIBUTE_NEXT_ENCRYPTION, defaultEncryption); + // don't ignore OTR + /*if (encryption == Message.ENCRYPTION_OTR) { + return defaultEncryption; + } else { + return encryption; + }*/ + return encryption; } public void setNextEncryption(int encryption) { |