diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-04-23 21:33:00 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-04-23 21:33:00 +0200 |
commit | 8e148f19ca3adf63a862192e79362677e8e1bdba (patch) | |
tree | 343632c6a695c58771af94a15a7b82ea73b0337f /src/main/java/de/pixart/messenger/parser | |
parent | 00174b878a2a1e0e8ee7175c18535f793cfc7e04 (diff) |
make error message for 'not encrypted for this device'
Diffstat (limited to 'src/main/java/de/pixart/messenger/parser')
-rw-r--r-- | src/main/java/de/pixart/messenger/parser/MessageParser.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/main/java/de/pixart/messenger/parser/MessageParser.java b/src/main/java/de/pixart/messenger/parser/MessageParser.java index 76318e0f2..6c24345e6 100644 --- a/src/main/java/de/pixart/messenger/parser/MessageParser.java +++ b/src/main/java/de/pixart/messenger/parser/MessageParser.java @@ -22,6 +22,7 @@ import de.pixart.messenger.Config; import de.pixart.messenger.R; import de.pixart.messenger.crypto.OtrService; import de.pixart.messenger.crypto.axolotl.AxolotlService; +import de.pixart.messenger.crypto.axolotl.NotEncryptedForThisDeviceException; import de.pixart.messenger.crypto.axolotl.XmppAxolotlMessage; import de.pixart.messenger.entities.Account; import de.pixart.messenger.entities.Bookmark; @@ -207,7 +208,12 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece return null; } if (xmppAxolotlMessage.hasPayload()) { - final XmppAxolotlMessage.XmppAxolotlPlaintextMessage plaintextMessage = service.processReceivingPayloadMessage(xmppAxolotlMessage, postpone); + final XmppAxolotlMessage.XmppAxolotlPlaintextMessage plaintextMessage; + try { + plaintextMessage = service.processReceivingPayloadMessage(xmppAxolotlMessage, postpone); + } catch (NotEncryptedForThisDeviceException e) { + return new Message(conversation, "", Message.ENCRYPTION_AXOLOTL_NOT_FOR_THIS_DEVICE, status); + } if (plaintextMessage != null) { Message finishedMessage = new Message(conversation, plaintextMessage.getPlaintext(), Message.ENCRYPTION_AXOLOTL, status); finishedMessage.setFingerprint(plaintextMessage.getFingerprint()); @@ -654,6 +660,8 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece if (message.getEncryption() == Message.ENCRYPTION_PGP) { notify = conversation.getAccount().getPgpDecryptionService().decrypt(message, notify); + } else if (message.getEncryption() == Message.ENCRYPTION_AXOLOTL_NOT_FOR_THIS_DEVICE) { + notify = false; } if (query == null) { |