aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/crypto
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-04-23 21:33:00 +0200
committerChristian Schneppe <christian@pix-art.de>2018-04-23 21:33:00 +0200
commit8e148f19ca3adf63a862192e79362677e8e1bdba (patch)
tree343632c6a695c58771af94a15a7b82ea73b0337f /src/main/java/de/pixart/messenger/crypto
parent00174b878a2a1e0e8ee7175c18535f793cfc7e04 (diff)
make error message for 'not encrypted for this device'
Diffstat (limited to 'src/main/java/de/pixart/messenger/crypto')
-rw-r--r--src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java b/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java
index ed432bb9b..f76711857 100644
--- a/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java
+++ b/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java
@@ -1372,16 +1372,23 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded {
return session;
}
- public XmppAxolotlMessage.XmppAxolotlPlaintextMessage processReceivingPayloadMessage(XmppAxolotlMessage message, boolean postponePreKeyMessageHandling) {
+ public XmppAxolotlMessage.XmppAxolotlPlaintextMessage processReceivingPayloadMessage(XmppAxolotlMessage message, boolean postponePreKeyMessageHandling) throws NotEncryptedForThisDeviceException {
XmppAxolotlMessage.XmppAxolotlPlaintextMessage plaintextMessage = null;
XmppAxolotlSession session = getReceivingSession(message);
+ int ownDeviceId = getOwnDeviceId();
try {
- plaintextMessage = message.decrypt(session, getOwnDeviceId());
+ plaintextMessage = message.decrypt(session, ownDeviceId);
Integer preKeyId = session.getPreKeyIdAndReset();
if (preKeyId != null) {
postPreKeyMessageHandling(session, preKeyId, postponePreKeyMessageHandling);
}
+ } catch (NotEncryptedForThisDeviceException e) {
+ if (account.getJid().asBareJid().equals(message.getFrom().asBareJid()) && message.getSenderDeviceId() == ownDeviceId) {
+ Log.w(Config.LOGTAG, getLogprefix(account) + "Reflected omemo message received");
+ } else {
+ throw e;
+ }
} catch (CryptoFailedException e) {
Log.w(Config.LOGTAG, getLogprefix(account) + "Failed to decrypt message from " + message.getFrom() + ": " + e.getMessage());
}