aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlookshe <github@lookshe.org>2016-03-20 17:37:44 +0100
committerlookshe <github@lookshe.org>2016-03-20 17:37:44 +0100
commita8db6be4eb932bfa54efb0bf50266c4167a32004 (patch)
tree97f49fc6363e92e0fccb85b65a081a13733b3151
parentd1e2023bd9b64d405af9648635ca17f0a7ff1010 (diff)
parentea6564c81a23c10bcdabeba7e29211e97c444d5b (diff)
Merge branch 'trz/rename' into trz/rebase
-rw-r--r--src/main/java/eu/siacs/conversations/entities/Message.java32
1 files changed, 14 insertions, 18 deletions
diff --git a/src/main/java/eu/siacs/conversations/entities/Message.java b/src/main/java/eu/siacs/conversations/entities/Message.java
index 8d302634..1793f949 100644
--- a/src/main/java/eu/siacs/conversations/entities/Message.java
+++ b/src/main/java/eu/siacs/conversations/entities/Message.java
@@ -360,29 +360,25 @@ public class Message extends AbstractEntity {
}
public boolean equals(Message message) {
- if (this.serverMsgId != null && message.getServerMsgId() != null) {
- return this.serverMsgId.equals(message.getServerMsgId());
- } else if (this.getBody() == null || this.counterpart == null) {
+ if (this.getServerMsgId() != null && message.getServerMsgId() != null) {
+ return this.getServerMsgId().equals(message.getServerMsgId());
+ } else if (this.getBody() == null || this.getCounterpart() == null
+ || message.getBody() == null || message.getCounterpart() == null) {
return false;
} else {
- String body, otherBody;
- if (this.hasFileOnRemoteHost()) {
- body = getFileParams().url.toString();
- otherBody = message.getBody() == null ? null : message.getBody();
- } else {
- body = this.getBody();
- otherBody = message.getBody();
- }
- if (message.getRemoteMsgId() != null) {
- return (message.getRemoteMsgId().equals(this.remoteMsgId) || message.getRemoteMsgId().equals(this.uuid))
- && this.counterpart.equals(message.getCounterpart())
- && (body.equals(otherBody)
+ 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())
||(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.remoteMsgId == null
- && this.counterpart.equals(message.getCounterpart())
- && body.equals(otherBody);
+ return this.getRemoteMsgId() == null
+ && message.getRemoteMsgId() == null
+ && this.getCounterpart().equals(message.getCounterpart())
+ && this.getBody().equals(message.getBody());
}
}
}