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
1 changed files with 10 additions and 0 deletions

View File

@ -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;
}