From 948fd85a43fe041f3220df168d6f5959dc2a244f Mon Sep 17 00:00:00 2001 From: kosyak Date: Tue, 29 Oct 2024 17:30:28 +0700 Subject: [PATCH] filter otr messages from mam queries --- .../java/eu/siacs/conversations/parser/MessageParser.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/parser/MessageParser.java b/src/main/java/eu/siacs/conversations/parser/MessageParser.java index e0ae5fc04..ea7261b3e 100644 --- a/src/main/java/eu/siacs/conversations/parser/MessageParser.java +++ b/src/main/java/eu/siacs/conversations/parser/MessageParser.java @@ -214,6 +214,10 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece finishedMessage.setFingerprint(otrService.getFingerprint(otrSession.getRemotePublicKey())); conversation.setLastReceivedOtrMessageId(null); + if (body.startsWith("?OTR")) { + return null; + } + return finishedMessage; } catch (Exception e) { conversation.resetOtrSession(); @@ -671,7 +675,7 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece } } else { Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": ignoring OTR message from " + from + " isForwarded=" + Boolean.toString(isForwarded) + ", isProperlyAddressed=" + Boolean.valueOf(isProperlyAddressed)); - message = null; + return; } } else if (pgpEncrypted != null && Config.supportOpenPgp()) { message = new Message(conversation, pgpEncrypted, Message.ENCRYPTION_PGP, status);