aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/de/pixart/messenger/parser/MessageParser.java6
-rw-r--r--src/main/java/de/pixart/messenger/services/MessageArchiveService.java15
2 files changed, 17 insertions, 4 deletions
diff --git a/src/main/java/de/pixart/messenger/parser/MessageParser.java b/src/main/java/de/pixart/messenger/parser/MessageParser.java
index 33ef59ef1..0f8e23aa6 100644
--- a/src/main/java/de/pixart/messenger/parser/MessageParser.java
+++ b/src/main/java/de/pixart/messenger/parser/MessageParser.java
@@ -804,7 +804,7 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
String id = received.getAttribute("id");
if (packet.fromAccount(account)) {
if (query != null && id != null && packet.getTo() != null) {
- query.pendingReceiptRequests.remove(new ReceiptRequest(packet.getTo(), id));
+ query.removePendingReceiptRequest(new ReceiptRequest(packet.getTo(), id));
}
} else {
mXmppConnectionService.markMessage(account, from.asBareJid(), received.getAttribute("id"), Message.STATUS_SEND_RECEIVED);
@@ -899,9 +899,9 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
packet.getType());
mXmppConnectionService.sendMessagePacket(account, receipt);
}
- } else {
+ } else { //just catchup??
if (request) {
- query.pendingReceiptRequests.add(new ReceiptRequest(packet.getFrom(), packet.getId()));
+ query.addPendingReceiptRequest(new ReceiptRequest(packet.getFrom(), packet.getId()));
}
}
}
diff --git a/src/main/java/de/pixart/messenger/services/MessageArchiveService.java b/src/main/java/de/pixart/messenger/services/MessageArchiveService.java
index 7158c3b1f..a20c7fc49 100644
--- a/src/main/java/de/pixart/messenger/services/MessageArchiveService.java
+++ b/src/main/java/de/pixart/messenger/services/MessageArchiveService.java
@@ -323,6 +323,7 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded {
private void processPostponed(Query query) {
query.account.getAxolotlService().processPostponed();
+ query.pendingReceiptRequests.removeAll(query.receiptRequests);
Log.d(Config.LOGTAG, query.getAccount().getJid().asBareJid() + ": found " + query.pendingReceiptRequests.size() + " pending receipt requests");
Iterator<ReceiptRequest> iterator = query.pendingReceiptRequests.iterator();
while (iterator.hasNext()) {
@@ -359,7 +360,8 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded {
}
public class Query {
- public HashSet<ReceiptRequest> pendingReceiptRequests = new HashSet<>();
+ private HashSet<ReceiptRequest> pendingReceiptRequests = new HashSet<>();
+ private HashSet<ReceiptRequest> receiptRequests = new HashSet<>();
private int totalCount = 0;
private int actualCount = 0;
private int actualInThisQuery = 0;
@@ -398,11 +400,22 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded {
query.totalCount = totalCount;
query.actualCount = actualCount;
query.pendingReceiptRequests = pendingReceiptRequests;
+ query.receiptRequests = receiptRequests;
query.callback = callback;
query.catchup = catchup;
return query;
}
+ public void removePendingReceiptRequest(ReceiptRequest receiptRequest) {
+ if (!this.pendingReceiptRequests.remove(receiptRequest)) {
+ this.receiptRequests.add(receiptRequest);
+ }
+ }
+
+ public void addPendingReceiptRequest(ReceiptRequest receiptRequest) {
+ this.pendingReceiptRequests.add(receiptRequest);
+ }
+
public boolean isLegacy() {
if (conversation == null || conversation.getMode() == Conversation.MODE_SINGLE) {
return account.getXmppConnection().getFeatures().mamLegacy();