aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorlookshe <github@lookshe.org>2016-03-21 03:12:34 +0100
committerlookshe <github@lookshe.org>2016-03-21 03:12:34 +0100
commitde3894f77c58579608fbe116c2dc5f36dcecbc8f (patch)
tree5a35731992f7087ac573e57fe88d3adb50da0d9a /src/main/java
parentdd8dac73d2564075f662df03892228a887fa1099 (diff)
parent47b982524e21ac3a58d742092943eef3e8edb7e1 (diff)
Merge branch 'trz/rename' into trz/rebase
Diffstat (limited to 'src/main/java')
-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);
}
}
}