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/parser/MessageParser.java10
-rw-r--r--src/main/java/eu/siacs/conversations/services/MessageArchiveService.java7
2 files changed, 13 insertions, 4 deletions
diff --git a/src/main/java/eu/siacs/conversations/parser/MessageParser.java b/src/main/java/eu/siacs/conversations/parser/MessageParser.java
index e55a4a28..a395be78 100644
--- a/src/main/java/eu/siacs/conversations/parser/MessageParser.java
+++ b/src/main/java/eu/siacs/conversations/parser/MessageParser.java
@@ -278,6 +278,10 @@ public class MessageParser extends AbstractParser implements
if (result == null ) {
return null;
}
+ final MessageArchiveService.Query query = this.mXmppConnectionService.getMessageArchiveService().findQuery(result.getAttribute("queryid"));
+ if (query!=null) {
+ query.incrementTotalCount();
+ }
final Element forwarded = result.findChild("forwarded","urn:xmpp:forward:0");
if (forwarded == null) {
return null;
@@ -304,7 +308,6 @@ public class MessageParser extends AbstractParser implements
final long timestamp = getTimestamp(forwarded);
final Jid to = message.getAttributeAsJid("to");
final Jid from = message.getAttributeAsJid("from");
- final MessageArchiveService.Query query = this.mXmppConnectionService.getMessageArchiveService().findQuery(result.getAttribute("queryid"));
Jid counterpart;
int status;
Conversation conversation;
@@ -324,8 +327,11 @@ public class MessageParser extends AbstractParser implements
finishedMessage.setCounterpart(counterpart);
finishedMessage.setRemoteMsgId(message.getAttribute("id"));
finishedMessage.setServerMsgId(result.getAttribute("id"));
+ if (conversation.hasDuplicateMessage(finishedMessage)) {
+ return null;
+ }
if (query!=null) {
- query.incrementCount();
+ query.incrementMessageCount();
}
return finishedMessage;
}
diff --git a/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java b/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java
index 66a2d48a..27689027 100644
--- a/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java
+++ b/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java
@@ -311,11 +311,14 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded {
return this.account;
}
- public void incrementCount() {
- this.count++;
+ public void incrementTotalCount() {
this.totalCount++;
}
+ public void incrementMessageCount() {
+ this.count++;
+ }
+
public int getTotalCount() {
return this.totalCount;
}