mirror of
https://github.com/moparisthebest/Conversations
synced 2024-11-16 22:05:07 -05:00
properly count mam messages
This commit is contained in:
parent
e2f50ab855
commit
3f6638cb64
@ -278,6 +278,10 @@ public class MessageParser extends AbstractParser implements
|
|||||||
if (result == null ) {
|
if (result == null ) {
|
||||||
return 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");
|
final Element forwarded = result.findChild("forwarded","urn:xmpp:forward:0");
|
||||||
if (forwarded == null) {
|
if (forwarded == null) {
|
||||||
return null;
|
return null;
|
||||||
@ -304,7 +308,6 @@ public class MessageParser extends AbstractParser implements
|
|||||||
final long timestamp = getTimestamp(forwarded);
|
final long timestamp = getTimestamp(forwarded);
|
||||||
final Jid to = message.getAttributeAsJid("to");
|
final Jid to = message.getAttributeAsJid("to");
|
||||||
final Jid from = message.getAttributeAsJid("from");
|
final Jid from = message.getAttributeAsJid("from");
|
||||||
final MessageArchiveService.Query query = this.mXmppConnectionService.getMessageArchiveService().findQuery(result.getAttribute("queryid"));
|
|
||||||
Jid counterpart;
|
Jid counterpart;
|
||||||
int status;
|
int status;
|
||||||
Conversation conversation;
|
Conversation conversation;
|
||||||
@ -324,8 +327,11 @@ public class MessageParser extends AbstractParser implements
|
|||||||
finishedMessage.setCounterpart(counterpart);
|
finishedMessage.setCounterpart(counterpart);
|
||||||
finishedMessage.setRemoteMsgId(message.getAttribute("id"));
|
finishedMessage.setRemoteMsgId(message.getAttribute("id"));
|
||||||
finishedMessage.setServerMsgId(result.getAttribute("id"));
|
finishedMessage.setServerMsgId(result.getAttribute("id"));
|
||||||
|
if (conversation.hasDuplicateMessage(finishedMessage)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
if (query!=null) {
|
if (query!=null) {
|
||||||
query.incrementCount();
|
query.incrementMessageCount();
|
||||||
}
|
}
|
||||||
return finishedMessage;
|
return finishedMessage;
|
||||||
}
|
}
|
||||||
|
@ -311,11 +311,14 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded {
|
|||||||
return this.account;
|
return this.account;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void incrementCount() {
|
public void incrementTotalCount() {
|
||||||
this.count++;
|
|
||||||
this.totalCount++;
|
this.totalCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void incrementMessageCount() {
|
||||||
|
this.count++;
|
||||||
|
}
|
||||||
|
|
||||||
public int getTotalCount() {
|
public int getTotalCount() {
|
||||||
return this.totalCount;
|
return this.totalCount;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user