kill mam query when archiving conversation

This commit is contained in:
Christian Schneppe 2018-02-24 15:55:45 +01:00
parent 47ad6bf5b5
commit 34718bcbbc
2 changed files with 21 additions and 0 deletions

View file

@ -300,6 +300,26 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded {
}
}
public void kill(Conversation conversation) {
synchronized (this.queries) {
for (Query q : queries) {
if (q.conversation == conversation) {
kill(q);
}
}
}
}
private void kill(Query query) {
Log.d(Config.LOGTAG, query.getAccount().getJid().toBareJid() + ": killing mam query prematurely");
query.callback = null;
this.finalizeQuery(query, false);
if (query.isCatchup() && query.getActualMessageCount() > 0) {
mXmppConnectionService.getNotificationService().finishBacklog(true, query.getAccount());
}
this.processPostponed(query);
}
private void processPostponed(Query query) {
query.account.getAxolotlService().processPostponed();
Log.d(Config.LOGTAG, query.getAccount().getJid().toBareJid() + ": found " + query.pendingReceiptRequests.size() + " pending receipt requests");

View file

@ -1978,6 +1978,7 @@ public class XmppConnectionService extends Service {
getNotificationService().clear(conversation);
conversation.setStatus(Conversation.STATUS_ARCHIVED);
synchronized (this.conversations) {
getMessageArchiveService().kill(conversation);
if (conversation.getMode() == Conversation.MODE_MULTI) {
if (conversation.getAccount().getStatus() == Account.State.ONLINE) {
Bookmark bookmark = conversation.getBookmark();