aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2014-08-24 11:21:02 +0200
committerDaniel Gultsch <daniel@gultsch.de>2014-08-24 11:21:02 +0200
commita30bc8a3e275890b9f39be56c1588aca34188dd4 (patch)
tree4da0e6e8466784696b24e276f58e390ba1267cb6
parente0b759340ded08ed7fcc3942473e7b3e3a91d2a1 (diff)
use otr encrypiton instead of plain when contact has exactly one online presence and an otr fingerprint
-rw-r--r--src/eu/siacs/conversations/entities/Conversation.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/eu/siacs/conversations/entities/Conversation.java b/src/eu/siacs/conversations/entities/Conversation.java
index ce29301c..439f9f22 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;
}