diff options
author | iNPUTmice <daniel@gultsch.de> | 2014-11-10 19:23:54 +0100 |
---|---|---|
committer | iNPUTmice <daniel@gultsch.de> | 2014-11-10 19:23:54 +0100 |
commit | 8740b55d37ce62e686afbf5d302fb49498ab6ab7 (patch) | |
tree | 871a5789e5c0809291f0e175891c9ab2c9830a31 /src/main/java/eu/siacs/conversations/entities/Conversation.java | |
parent | c8a6b051639528f4e8e39ff09e4bda36e3191f10 (diff) |
initial smp support
Diffstat (limited to '')
-rw-r--r-- | src/main/java/eu/siacs/conversations/entities/Conversation.java | 30 |
1 files changed, 28 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 c8dedd7b3..622e0f839 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); @@ -503,4 +517,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; + } } |