aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/entities
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2014-08-23 15:57:39 +0200
committerDaniel Gultsch <daniel@gultsch.de>2014-08-23 15:57:39 +0200
commitf7437ecc360b8ceb2ac976172831034a7c5e4260 (patch)
treef8cf52d2bea46d9a7e2f1e926a601c39cca0a7af /src/eu/siacs/conversations/entities
parentee9872277dd83e3109633bd7b59a962555e663b5 (diff)
experimental muc message deduplication
Diffstat (limited to 'src/eu/siacs/conversations/entities')
-rw-r--r--src/eu/siacs/conversations/entities/Conversation.java9
-rw-r--r--src/eu/siacs/conversations/entities/Message.java8
2 files changed, 17 insertions, 0 deletions
diff --git a/src/eu/siacs/conversations/entities/Conversation.java b/src/eu/siacs/conversations/entities/Conversation.java
index be641ea4..ce29301c 100644
--- a/src/eu/siacs/conversations/entities/Conversation.java
+++ b/src/eu/siacs/conversations/entities/Conversation.java
@@ -399,4 +399,13 @@ public class Conversation extends AbstractEntity {
return UIHelper.getContactPicture(this, size, context, false);
}
}
+
+ public boolean hasDuplicateMessage(Message message) {
+ for(int i = this.getMessages().size() -1; i >= 0; --i) {
+ if (this.messages.get(i).equals(message)) {
+ return true;
+ }
+ }
+ return false;
+ }
}
diff --git a/src/eu/siacs/conversations/entities/Message.java b/src/eu/siacs/conversations/entities/Message.java
index b669efc5..6d70b66d 100644
--- a/src/eu/siacs/conversations/entities/Message.java
+++ b/src/eu/siacs/conversations/entities/Message.java
@@ -275,4 +275,12 @@ public class Message extends AbstractEntity {
public void setCounterpart(String counterpart) {
this.counterpart = counterpart;
}
+
+ public boolean equals(Message message) {
+ if ((this.remoteMsgId!=null) && (this.body != null) && (this.counterpart != null)) {
+ return this.remoteMsgId.equals(message.getRemoteMsgId()) && this.body.equals(message.getBody()) && this.counterpart.equals(message.getCounterpart());
+ } else {
+ return false;
+ }
+ }
}