diff options
author | steckbrief <steckbrief@chefmail.de> | 2016-02-13 21:22:14 +0100 |
---|---|---|
committer | steckbrief <steckbrief@chefmail.de> | 2016-02-13 21:22:14 +0100 |
commit | 4829c301e6a5aab2dbafce9b0662500a8f1fc058 (patch) | |
tree | 6293cf84064dd598fdb1a6a916c8e2361d3b5aee | |
parent | 0af30b4aec590615631a37362d7edf10af88ffd5 (diff) |
Fix flagging no more messages on server for conversation
Diffstat (limited to '')
-rw-r--r-- | src/main/java/eu/siacs/conversations/services/MessageArchiveService.java | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java b/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java index eb0862f0..34d4a7cd 100644 --- a/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java +++ b/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java @@ -130,21 +130,21 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded { Logging.d(Config.LOGTAG, account.getJid().toBareJid().toString() + ": running mam query " + query.toString()); IqPacket packet = this.mXmppConnectionService.getIqGenerator().queryMessageArchiveManagement(query); this.mXmppConnectionService.sendIqPacket(account, packet, new OnIqPacketReceived() { - @Override - public void onIqPacketReceived(Account account, IqPacket packet) { - if (packet.getType() == IqPacket.TYPE.TIMEOUT) { - synchronized (MessageArchiveService.this.queries) { - MessageArchiveService.this.queries.remove(query); - if (query.hasCallback()) { - query.callback(); - } - } - } else if (packet.getType() != IqPacket.TYPE.RESULT) { - Logging.d(Config.LOGTAG, account.getJid().toBareJid().toString() + ": error executing mam: " + packet.toString()); - finalizeQuery(query); - } - } - }); + @Override + public void onIqPacketReceived(Account account, IqPacket packet) { + if (packet.getType() == IqPacket.TYPE.TIMEOUT) { + synchronized (MessageArchiveService.this.queries) { + MessageArchiveService.this.queries.remove(query); + if (query.hasCallback()) { + query.callback(); + } + } + } else if (packet.getType() != IqPacket.TYPE.RESULT) { + Logging.d(Config.LOGTAG, account.getJid().toBareJid().toString() + ": error executing mam: " + packet.toString()); + finalizeQuery(query); + } + } + }); } else { synchronized (this.pendingQueries) { this.pendingQueries.add(query); @@ -159,7 +159,6 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded { final Conversation conversation = query.getConversation(); if (conversation != null) { conversation.sort(); - conversation.setHasMessagesLeftOnServer(query.getMessageCount() > 0); } else { for(Conversation tmp : this.mXmppConnectionService.getConversations()) { if (tmp.getAccount() == query.getAccount()) { @@ -170,6 +169,9 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded { if (query.hasCallback()) { query.callback(); } else { + if (null != conversation) { + conversation.setHasMessagesLeftOnServer(query.getMessageCount() > 0); + } this.mXmppConnectionService.updateConversationUi(); } } |