aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2016-12-26 15:13:38 +0100
committerDaniel Gultsch <daniel@gultsch.de>2016-12-26 15:13:38 +0100
commitb8f67bfaa38509055ed3cf60877c1d3490b10bc1 (patch)
tree98e90cff28ccdb981ca3dbb5c06eefbfef7d1914 /src/main
parent82c2e89d2190d9efabfdee969d77947f41c1f419 (diff)
deduplicate corrected messages
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/eu/siacs/conversations/entities/Message.java13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/main/java/eu/siacs/conversations/entities/Message.java b/src/main/java/eu/siacs/conversations/entities/Message.java
index 20e4c5a5..c53bb061 100644
--- a/src/main/java/eu/siacs/conversations/entities/Message.java
+++ b/src/main/java/eu/siacs/conversations/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;
}