diff options
author | iNPUTmice <daniel@gultsch.de> | 2014-12-17 06:59:58 +0100 |
---|---|---|
committer | iNPUTmice <daniel@gultsch.de> | 2014-12-17 06:59:58 +0100 |
commit | 3f6638cb649b650fbf0217d8a060bf149a9b886f (patch) | |
tree | ae806c18bdbfd7683a0f033d25493b5d04f08978 /src/main/java/eu/siacs/conversations/parser/MessageParser.java | |
parent | e2f50ab8558a32ff54b6c6c80da319b4a396e173 (diff) |
properly count mam messages
Diffstat (limited to 'src/main/java/eu/siacs/conversations/parser/MessageParser.java')
-rw-r--r-- | src/main/java/eu/siacs/conversations/parser/MessageParser.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/main/java/eu/siacs/conversations/parser/MessageParser.java b/src/main/java/eu/siacs/conversations/parser/MessageParser.java index e55a4a288..a395be78a 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; } |