diff options
Diffstat (limited to 'src/eu/siacs/conversations/entities/Conversation.java')
-rw-r--r-- | src/eu/siacs/conversations/entities/Conversation.java | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/src/eu/siacs/conversations/entities/Conversation.java b/src/eu/siacs/conversations/entities/Conversation.java index 0f4d24e5..5674f84a 100644 --- a/src/eu/siacs/conversations/entities/Conversation.java +++ b/src/eu/siacs/conversations/entities/Conversation.java @@ -15,7 +15,6 @@ import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.net.Uri; -import android.util.Log; public class Conversation extends AbstractEntity { @@ -56,7 +55,8 @@ public class Conversation extends AbstractEntity { private transient String otrFingerprint = null; - public int nextMessageEncryption = Message.ENCRYPTION_NONE; + private int nextMessageEncryption = -1; + private String nextMessage; private transient MucOptions mucOptions = null; @@ -237,7 +237,6 @@ public class Conversation extends AbstractEntity { } return this.otrSession; } catch (OtrException e) { - Log.d("xmppServic", "couldnt start otr"); return null; } } @@ -320,4 +319,32 @@ public class Conversation extends AbstractEntity { public String getNextPresence() { return this.nextPresence; } + + public int getLatestEncryption() { + int latestEncryption = this.getLatestMessage().getEncryption(); + if ((latestEncryption == Message.ENCRYPTION_DECRYPTED) || (latestEncryption == Message.ENCRYPTION_DECRYPTION_FAILED)) { + return Message.ENCRYPTION_PGP; + } else { + return latestEncryption; + } + } + + public int getNextEncryption() { + if (this.nextMessageEncryption == -1) { + return this.getLatestEncryption(); + } + return this.nextMessageEncryption; + } + + public void setNextEncryption(int encryption) { + this.nextMessageEncryption = encryption; + } + + public String getNextMessage() { + return this.nextMessage; + } + + public void setNextMessage(String message) { + this.nextMessage = message; + } } |