aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/entities/Conversation.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/eu/siacs/conversations/entities/Conversation.java')
-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;
+ }
}