overwrite body for plaintext group chat messages only

This commit is contained in:
Daniel Gultsch 2021-03-07 09:59:09 +01:00
parent e947a3f808
commit 0fa06d65b5
1 changed files with 8 additions and 1 deletions

View File

@ -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);
}