aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/services
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-02-24 15:55:45 +0100
committerChristian Schneppe <christian@pix-art.de>2018-02-24 15:55:45 +0100
commit34718bcbbc2f0406607766e088d89ae2445999e5 (patch)
treeb0d47ce15876bf69029cf6835d0f1a388130bb97 /src/main/java/de/pixart/messenger/services
parent47ad6bf5b548018cbbb7ba1c0b8d5fd922ba2611 (diff)
kill mam query when archiving conversation
Diffstat (limited to 'src/main/java/de/pixart/messenger/services')
-rw-r--r--src/main/java/de/pixart/messenger/services/MessageArchiveService.java20
-rw-r--r--src/main/java/de/pixart/messenger/services/XmppConnectionService.java1
2 files changed, 21 insertions, 0 deletions
diff --git a/src/main/java/de/pixart/messenger/services/MessageArchiveService.java b/src/main/java/de/pixart/messenger/services/MessageArchiveService.java
index 8611bf873..f0d48a86f 100644
--- a/src/main/java/de/pixart/messenger/services/MessageArchiveService.java
+++ b/src/main/java/de/pixart/messenger/services/MessageArchiveService.java
@@ -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");
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
index afa24f671..96c80c93d 100644
--- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
+++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
@@ -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();