diff options
author | iNPUTmice <daniel@gultsch.de> | 2014-11-15 15:50:35 +0100 |
---|---|---|
committer | iNPUTmice <daniel@gultsch.de> | 2014-11-15 15:50:35 +0100 |
commit | 5b9c690c47cbb6fd352d7ddce3b13e6bf119fc22 (patch) | |
tree | d6f19365a8a72d1f711e3d4055d354d16fe5bcaf /src/main/java/eu/siacs/conversations/entities | |
parent | 4c504dea7ac7b0413df89ec630408b91f4abddb4 (diff) | |
parent | f1e2be4096d1c023adc2c9eec49bcf64b9a453de (diff) |
Merge branch 'feature/otr_verification' into development
Diffstat (limited to 'src/main/java/eu/siacs/conversations/entities')
-rw-r--r-- | src/main/java/eu/siacs/conversations/entities/Conversation.java | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/src/main/java/eu/siacs/conversations/entities/Conversation.java b/src/main/java/eu/siacs/conversations/entities/Conversation.java index c8dedd7b..a9f4c0f1 100644 --- a/src/main/java/eu/siacs/conversations/entities/Conversation.java +++ b/src/main/java/eu/siacs/conversations/entities/Conversation.java @@ -63,13 +63,12 @@ public class Conversation extends AbstractEntity { private transient SessionImpl otrSession; private transient String otrFingerprint = null; + private Smp mSmp = new Smp(); private String nextMessage; private transient MucOptions mucOptions = null; - // private transient String latestMarkableMessageId; - private byte[] symmetricKey; private Bookmark bookmark; @@ -271,6 +270,13 @@ public class Conversation extends AbstractEntity { public void resetOtrSession() { this.otrFingerprint = null; this.otrSession = null; + this.mSmp.hint = null; + this.mSmp.secret = null; + this.mSmp.status = Smp.STATUS_NONE; + } + + public Smp smp() { + return mSmp; } public void startOtrIfNeeded() { @@ -330,6 +336,14 @@ public class Conversation extends AbstractEntity { return this.otrFingerprint; } + public void verifyOtrFingerprint() { + getContact().addOtrFingerprint(getOtrFingerprint()); + } + + public boolean isOtrFingerprintVerified() { + return getContact().getOtrFingerprints().contains(getOtrFingerprint()); + } + public synchronized MucOptions getMucOptions() { if (this.mucOptions == null) { this.mucOptions = new MucOptions(this); @@ -403,6 +417,10 @@ public class Conversation extends AbstractEntity { } } + public boolean smpRequested() { + return smp().status == Smp.STATUS_CONTACT_REQUESTED; + } + public void setNextMessage(String message) { this.nextMessage = message; } @@ -503,4 +521,16 @@ public class Conversation extends AbstractEntity { this.messages.addAll(index, messages); } } + + public class Smp { + public static final int STATUS_NONE = 0; + public static final int STATUS_CONTACT_REQUESTED = 1; + public static final int STATUS_WE_REQUESTED = 2; + public static final int STATUS_FAILED = 3; + public static final int STATUS_VERIFIED = 4; + + public String secret = null; + public String hint = null; + public int status = 0; + } } |