diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-12-04 21:14:53 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-12-04 21:14:53 +0100 |
commit | 72a6e378646f0d42cce97616bd2f01b84870049c (patch) | |
tree | 6625d3d2d08dfa0dc8f13d53452ed5e8dacd08fa /src/main/java/de/pixart/messenger/entities | |
parent | 50dbd4077f825bb6e594d652745cd5461db3a9df (diff) |
implement self healing omemo
after receiving a SignalMessage that can’t be decrypted because of broken sessions
Conversations will attempt to grab a new pre key bundle and send a new PreKeySignalMessage
wrapped in a key transport message.
Diffstat (limited to '')
-rw-r--r-- | src/main/java/de/pixart/messenger/entities/Conversation.java | 14 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/entities/Message.java | 3 |
2 files changed, 16 insertions, 1 deletions
diff --git a/src/main/java/de/pixart/messenger/entities/Conversation.java b/src/main/java/de/pixart/messenger/entities/Conversation.java index 809cee166..502f2638d 100644 --- a/src/main/java/de/pixart/messenger/entities/Conversation.java +++ b/src/main/java/de/pixart/messenger/entities/Conversation.java @@ -897,6 +897,20 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl } } + public boolean possibleDuplicate(final String serverMsgId, final String remoteMsgId) { + if (serverMsgId == null || remoteMsgId == null) { + return false; + } + synchronized (this.messages) { + for (Message message : this.messages) { + if (serverMsgId.equals(message.getServerMsgId()) || remoteMsgId.equals(message.getRemoteMsgId())) { + return true; + } + } + } + return false; + } + public MamReference getLastMessageTransmitted() { final MamReference lastClear = getLastClearHistory(); MamReference lastReceived = new MamReference(0); diff --git a/src/main/java/de/pixart/messenger/entities/Message.java b/src/main/java/de/pixart/messenger/entities/Message.java index 6d11d54d3..abeda3ad3 100644 --- a/src/main/java/de/pixart/messenger/entities/Message.java +++ b/src/main/java/de/pixart/messenger/entities/Message.java @@ -45,6 +45,7 @@ public class Message extends AbstractEntity { public static final int ENCRYPTION_DECRYPTION_FAILED = 4; public static final int ENCRYPTION_AXOLOTL = 5; public static final int ENCRYPTION_AXOLOTL_NOT_FOR_THIS_DEVICE = 6; + public static final int ENCRYPTION_AXOLOTL_FAILED = 7; public static final int TYPE_TEXT = 0; public static final int TYPE_IMAGE = 1; @@ -913,7 +914,7 @@ public class Message extends AbstractEntity { if (encryption == ENCRYPTION_DECRYPTED || encryption == ENCRYPTION_DECRYPTION_FAILED) { return ENCRYPTION_PGP; } - if (encryption == ENCRYPTION_AXOLOTL_NOT_FOR_THIS_DEVICE) { + if (encryption == ENCRYPTION_AXOLOTL_NOT_FOR_THIS_DEVICE || encryption == ENCRYPTION_AXOLOTL_FAILED) { return ENCRYPTION_AXOLOTL; } return encryption; |