aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/entities
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-09-08 13:37:22 +0200
committeriNPUTmice <daniel@gultsch.de>2014-09-08 13:37:22 +0200
commit58953e6193b25ca9fd7624954ef7cb986e43b3da (patch)
tree63a56da9c490a5ced9bff32ceec5be4fb793feac /src/eu/siacs/conversations/entities
parent3b9fd28ef4b8c615ec27c7265c2e38dfa31d41fd (diff)
settings to force encryption and setting for not saving messages to disk. fixed #353
Diffstat (limited to 'src/eu/siacs/conversations/entities')
-rw-r--r--src/eu/siacs/conversations/entities/Conversation.java29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/eu/siacs/conversations/entities/Conversation.java b/src/eu/siacs/conversations/entities/Conversation.java
index 9f7ba3aa..7c6b5837 100644
--- a/src/eu/siacs/conversations/entities/Conversation.java
+++ b/src/eu/siacs/conversations/entities/Conversation.java
@@ -339,24 +339,29 @@ 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;
}
}
- public int getNextEncryption() {
+ public int getNextEncryption(boolean force) {
if (this.nextMessageEncryption == -1) {
- return this.getLatestEncryption();
+ int latest = this.getLatestEncryption();
+ if (latest == Message.ENCRYPTION_NONE) {
+ if (force && getMode() == MODE_SINGLE) {
+ return Message.ENCRYPTION_OTR;
+ } else if (getContact().getPresences().size() == 1) {
+ if (getContact().getOtrFingerprints().size() >= 1) {
+ return Message.ENCRYPTION_OTR;
+ } else {
+ return latest;
+ }
+ } else {
+ return latest;
+ }
+ } else {
+ return latest;
+ }
}
return this.nextMessageEncryption;
}