diff options
author | Christian Schneppe <christian@pix-art.de> | 2016-12-27 23:31:21 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2016-12-27 23:31:21 +0100 |
commit | 8a8f31882a13c69218e49dacbfc7cb5266c52b9f (patch) | |
tree | 970b4469b0a8f993c64c04c42a4b21baaee881a9 /src/main/java/de/pixart | |
parent | 19c07028ed7f46c4d94e746fc8cdc7c9b68d1cbc (diff) |
deduplicate corrected messages
Diffstat (limited to 'src/main/java/de/pixart')
-rw-r--r-- | src/main/java/de/pixart/messenger/entities/Message.java | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/main/java/de/pixart/messenger/entities/Message.java b/src/main/java/de/pixart/messenger/entities/Message.java index 14120908f..8ac7735d6 100644 --- a/src/main/java/de/pixart/messenger/entities/Message.java +++ b/src/main/java/de/pixart/messenger/entities/Message.java @@ -411,15 +411,18 @@ public class Message extends AbstractEntity { body = this.body; otherBody = message.body; } + final boolean matchingCounterpart = this.counterpart.equals(message.getCounterpart()); if (message.getRemoteMsgId() != null) { + final boolean hasUuid = CryptoHelper.UUID_PATTERN.matcher(message.getRemoteMsgId()).matches(); + if (hasUuid && this.edited != null && matchingCounterpart && this.edited.equals(message.getRemoteMsgId())) { + return true; + } return (message.getRemoteMsgId().equals(this.remoteMsgId) || message.getRemoteMsgId().equals(this.uuid)) - && this.counterpart.equals(message.getCounterpart()) - && (body.equals(otherBody) - || (message.getEncryption() == Message.ENCRYPTION_PGP - && CryptoHelper.UUID_PATTERN.matcher(message.getRemoteMsgId()).matches())); + && matchingCounterpart + && (body.equals(otherBody) ||(message.getEncryption() == Message.ENCRYPTION_PGP && hasUuid)); } else { return this.remoteMsgId == null - && this.counterpart.equals(message.getCounterpart()) + && matchingCounterpart && body.equals(otherBody) && Math.abs(this.getTimeSent() - message.getTimeSent()) < Config.MESSAGE_MERGE_WINDOW * 1000; } |