aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/entities
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-11-10 19:23:54 +0100
committeriNPUTmice <daniel@gultsch.de>2014-11-11 17:40:51 +0100
commit6cd2ff0d886b03079036570c74ecb70050b1de2d (patch)
tree2f78c38e3d4c67c74aa34191dd2abdb2dc90e439 /src/main/java/eu/siacs/conversations/entities
parente555fe4b033d2ad342d757217bb59704ad8207f9 (diff)
initial smp support
Diffstat (limited to 'src/main/java/eu/siacs/conversations/entities')
-rw-r--r--src/main/java/eu/siacs/conversations/entities/Conversation.java30
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 c8dedd7b..622e0f83 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;
+ }
}