use otr encrypiton instead of plain when contact has exactly one online presence and an otr fingerprint

This commit is contained in:
Daniel Gultsch 2014-08-24 11:21:02 +02:00
parent e0b759340d
commit a30bc8a3e2

View file

@ -335,6 +335,16 @@ public class Conversation extends AbstractEntity {
if ((latestEncryption == Message.ENCRYPTION_DECRYPTED) if ((latestEncryption == Message.ENCRYPTION_DECRYPTED)
|| (latestEncryption == Message.ENCRYPTION_DECRYPTION_FAILED)) { || (latestEncryption == Message.ENCRYPTION_DECRYPTION_FAILED)) {
return Message.ENCRYPTION_PGP; 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 { } else {
return latestEncryption; return latestEncryption;
} }