From 908aa19a36eaf80442da153cbac729d3fdb0aa31 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Thu, 12 May 2016 14:20:11 +0200 Subject: make omemo default when all resources support it --- .../eu/siacs/conversations/entities/Conversation.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/main/java/eu/siacs/conversations/entities/Conversation.java') diff --git a/src/main/java/eu/siacs/conversations/entities/Conversation.java b/src/main/java/eu/siacs/conversations/entities/Conversation.java index b1d597df..646bc2be 100644 --- a/src/main/java/eu/siacs/conversations/entities/Conversation.java +++ b/src/main/java/eu/siacs/conversations/entities/Conversation.java @@ -27,6 +27,7 @@ import eu.siacs.conversations.xmpp.chatstate.ChatState; import eu.siacs.conversations.xmpp.jid.InvalidJidException; import eu.siacs.conversations.xmpp.jid.Jid; + public class Conversation extends AbstractEntity implements Blockable { public static final String TABLENAME = "conversations"; @@ -678,12 +679,12 @@ public class Conversation extends AbstractEntity implements Blockable { final AxolotlService axolotlService = getAccount().getAxolotlService(); int next = this.getIntAttribute(ATTRIBUTE_NEXT_ENCRYPTION, -1); if (next == -1) { - if (Config.X509_VERIFICATION) { - if (axolotlService != null && axolotlService.isConversationAxolotlCapable(this)) { - return Message.ENCRYPTION_AXOLOTL; - } else { - return Message.ENCRYPTION_NONE; - } + if (Config.supportOmemo() + && axolotlService != null + && mode == MODE_SINGLE + && axolotlService.isConversationAxolotlCapable(this) + && getContact().getPresences().allOrNonSupport(AxolotlService.PEP_DEVICE_LIST_NOTIFY)) { + return Message.ENCRYPTION_AXOLOTL; } int outgoing = this.getMostRecentlyUsedOutgoingEncryption(); if (outgoing == Message.ENCRYPTION_NONE) { @@ -695,7 +696,7 @@ public class Conversation extends AbstractEntity implements Blockable { if (!Config.supportUnencrypted() && next <= 0) { if (Config.supportOmemo() - && (axolotlService != null && axolotlService.isConversationAxolotlCapable(this) || !Config.multipleEncryptionChoices())) { + && ((axolotlService != null && axolotlService.isConversationAxolotlCapable(this)) || !Config.multipleEncryptionChoices())) { return Message.ENCRYPTION_AXOLOTL; } else if (Config.supportOtr() && mode == MODE_SINGLE) { return Message.ENCRYPTION_OTR; -- cgit v1.2.3 From e41a9483bdc1aa772b9f69695cb96643effb1827 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Fri, 13 May 2016 11:47:29 +0200 Subject: only default to omemo when all our devices support it --- src/main/java/eu/siacs/conversations/entities/Conversation.java | 1 + 1 file changed, 1 insertion(+) (limited to 'src/main/java/eu/siacs/conversations/entities/Conversation.java') diff --git a/src/main/java/eu/siacs/conversations/entities/Conversation.java b/src/main/java/eu/siacs/conversations/entities/Conversation.java index 646bc2be..9d814046 100644 --- a/src/main/java/eu/siacs/conversations/entities/Conversation.java +++ b/src/main/java/eu/siacs/conversations/entities/Conversation.java @@ -683,6 +683,7 @@ public class Conversation extends AbstractEntity implements Blockable { && axolotlService != null && mode == MODE_SINGLE && axolotlService.isConversationAxolotlCapable(this) + && getAccount().getSelfContact().getPresences().allOrNonSupport(AxolotlService.PEP_DEVICE_LIST_NOTIFY) && getContact().getPresences().allOrNonSupport(AxolotlService.PEP_DEVICE_LIST_NOTIFY)) { return Message.ENCRYPTION_AXOLOTL; } -- cgit v1.2.3 From 70497318ddb8f4a441ef369e24041a3e4d4e1f1f Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Thu, 19 May 2016 10:42:57 +0200 Subject: remove unwanted 'use previous encryption' lookup --- .../siacs/conversations/entities/Conversation.java | 23 +--------------------- 1 file changed, 1 insertion(+), 22 deletions(-) (limited to 'src/main/java/eu/siacs/conversations/entities/Conversation.java') diff --git a/src/main/java/eu/siacs/conversations/entities/Conversation.java b/src/main/java/eu/siacs/conversations/entities/Conversation.java index 9d814046..10b42b46 100644 --- a/src/main/java/eu/siacs/conversations/entities/Conversation.java +++ b/src/main/java/eu/siacs/conversations/entities/Conversation.java @@ -641,23 +641,6 @@ public class Conversation extends AbstractEntity implements Blockable { return this.nextCounterpart; } - private int getMostRecentlyUsedOutgoingEncryption() { - synchronized (this.messages) { - for(int i = this.messages.size() -1; i >= 0; --i) { - final Message m = this.messages.get(i); - if (!m.isCarbon() && m.getStatus() != Message.STATUS_RECEIVED) { - final int e = m.getEncryption(); - if (e == Message.ENCRYPTION_DECRYPTED || e == Message.ENCRYPTION_DECRYPTION_FAILED) { - return Message.ENCRYPTION_PGP; - } else { - return e; - } - } - } - } - return Message.ENCRYPTION_NONE; - } - private int getMostRecentlyUsedIncomingEncryption() { synchronized (this.messages) { for(int i = this.messages.size() -1; i >= 0; --i) { @@ -686,12 +669,8 @@ public class Conversation extends AbstractEntity implements Blockable { && getAccount().getSelfContact().getPresences().allOrNonSupport(AxolotlService.PEP_DEVICE_LIST_NOTIFY) && getContact().getPresences().allOrNonSupport(AxolotlService.PEP_DEVICE_LIST_NOTIFY)) { return Message.ENCRYPTION_AXOLOTL; - } - int outgoing = this.getMostRecentlyUsedOutgoingEncryption(); - if (outgoing == Message.ENCRYPTION_NONE) { - next = this.getMostRecentlyUsedIncomingEncryption(); } else { - next = outgoing; + next = this.getMostRecentlyUsedIncomingEncryption(); } } -- cgit v1.2.3