From a30bc8a3e275890b9f39be56c1588aca34188dd4 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sun, 24 Aug 2014 11:21:02 +0200 Subject: [PATCH] use otr encrypiton instead of plain when contact has exactly one online presence and an otr fingerprint --- src/eu/siacs/conversations/entities/Conversation.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/eu/siacs/conversations/entities/Conversation.java b/src/eu/siacs/conversations/entities/Conversation.java index ce29301c9..439f9f22f 100644 --- a/src/eu/siacs/conversations/entities/Conversation.java +++ b/src/eu/siacs/conversations/entities/Conversation.java @@ -335,6 +335,16 @@ public class Conversation extends AbstractEntity { if ((latestEncryption == Message.ENCRYPTION_DECRYPTED) || (latestEncryption == Message.ENCRYPTION_DECRYPTION_FAILED)) { return Message.ENCRYPTION_PGP; + } else if (latestEncryption == Message.ENCRYPTION_NONE) { + if (getContact().getPresences().size() == 1) { + if (getContact().getOtrFingerprints().size() >= 1) { + return Message.ENCRYPTION_OTR; + } else { + return latestEncryption; + } + } else { + return latestEncryption; + } } else { return latestEncryption; }