kill mam query when archiving conversation

This commit is contained in:
Daniel Gultsch 2018-02-24 09:39:17 +01:00
parent 1a1d5c2a3e
commit 03fa58634b
2 changed files with 21 additions and 0 deletions

View file

@ -301,6 +301,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

@ -1794,6 +1794,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();