aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2015-01-20 22:54:58 +0100
committeriNPUTmice <daniel@gultsch.de>2015-01-20 22:54:58 +0100
commit7839438f513c101f831ec47b3d0224df07835e51 (patch)
tree7a1b331eabf15a6ac83ebb2972b7a329ee48c02a /src/main
parent6dc53c2b3505adbe8e0c7b7991c0df4716b9b834 (diff)
changed message duplicate finder
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/eu/siacs/conversations/entities/Message.java15
1 files changed, 10 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 c25b300b..55a1d2ce 100644
--- a/src/main/java/eu/siacs/conversations/entities/Message.java
+++ b/src/main/java/eu/siacs/conversations/entities/Message.java
@@ -311,12 +311,17 @@ 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.body == null || this.counterpart == null) {
+ return false;
+ } else if (message.getRemoteMsgId() != null) {
+ return (message.getRemoteMsgId().equals(this.remoteMsgId) || message.getRemoteMsgId().equals(this.uuid))
+ && this.counterpart.equals(message.getCounterpart())
+ && this.body.equals(message.getBody());
} else {
- return this.body != null
- && this.counterpart != null
- && ((this.remoteMsgId != null && this.remoteMsgId.equals(message.getRemoteMsgId()))
- || this.uuid.equals(message.getRemoteMsgId())) && this.body.equals(message.getBody())
- && this.counterpart.equals(message.getCounterpart());
+ return this.remoteMsgId == null
+ && this.counterpart.equals(message.getCounterpart())
+ && this.body.equals(message.getBody())
+ && Math.abs(this.getTimeSent() - message.getTimeSent()) < Config.PING_TIMEOUT * 500;
}
}