aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/eu/siacs')
-rw-r--r--src/main/java/eu/siacs/conversations/entities/Message.java23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/main/java/eu/siacs/conversations/entities/Message.java b/src/main/java/eu/siacs/conversations/entities/Message.java
index 1793f949..5fafb6c8 100644
--- a/src/main/java/eu/siacs/conversations/entities/Message.java
+++ b/src/main/java/eu/siacs/conversations/entities/Message.java
@@ -366,19 +366,34 @@ public class Message extends AbstractEntity {
|| message.getBody() == null || message.getCounterpart() == null) {
return false;
} else {
+ String body, otherBody;
+ if (this.hasFileOnRemoteHost()) {
+ body = this.getFileParams().url.toString();
+ } else {
+ body = this.getBody();
+ }
+ if (message.hasFileOnRemoteHost()) {
+ otherBody = message.getFileParams().url.toString();
+ } else {
+ otherBody = message.getBody();
+ }
+
if (message.getRemoteMsgId() != null && this.getRemoteMsgId() != null) {
return (message.getRemoteMsgId().equals(this.getRemoteMsgId())
|| message.getRemoteMsgId().equals(this.getUuid())
|| message.getUuid().equals(this.getRemoteMsgId()))
&& this.getCounterpart().equals(message.getCounterpart())
- && (this.getBody().equals(message.getBody())
+ && (body.equals(otherBody)
||(message.getEncryption() == Message.ENCRYPTION_PGP
&& message.getRemoteMsgId().matches("[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}"))) ;
} else {
- return this.getRemoteMsgId() == null
- && message.getRemoteMsgId() == null
+ // existing (send) message with no remoteMsgId and MAM message with remoteMsgId
+ return ((this.getRemoteMsgId() == null && message.getRemoteMsgId() != null)
+ || (this.getRemoteMsgId() != null && message.getRemoteMsgId() == null)
+ // both null is also acceptable
+ || (this.getRemoteMsgId() == null && message.getRemoteMsgId() == null))
&& this.getCounterpart().equals(message.getCounterpart())
- && this.getBody().equals(message.getBody());
+ && body.equals(otherBody);
}
}
}