From 0fa06d65b59f13bae8174e85186fa1d66f464c1b Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sun, 7 Mar 2021 09:59:09 +0100 Subject: [PATCH] overwrite body for plaintext group chat messages only --- .../conversations/services/XmppConnectionService.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 9cd3e2627..5880dfa56 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -3964,7 +3964,7 @@ public class XmppConnectionService extends Service { if (message.getServerMsgId() == null) { message.setServerMsgId(serverMessageId); } - if (body != null && body.content != null && !body.content.equals(message.getBody())) { + if (message.getEncryption() == Message.ENCRYPTION_NONE && isBodyModified(message, body)) { message.setBody(body.content); if (body.count > 1) { message.setBodyLanguage(body.language); @@ -3980,6 +3980,13 @@ public class XmppConnectionService extends Service { } } + private static boolean isBodyModified(final Message message, final LocalizedContent body) { + if (body == null || body.content == null) { + return false; + } + return !body.content.equals(message.getBody()); + } + public void markMessage(Message message, int status) { markMessage(message, status, null); }