MAM: rework hasMessagesLeft to account for prosody’s missing count

This commit is contained in:
Daniel Gultsch 2018-02-24 10:57:11 +01:00
parent 90ace36b18
commit 4013123279
1 changed files with 12 additions and 6 deletions

View File

@ -270,12 +270,18 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded {
query.getConversation().setFirstMamReference(first == null ? null : first.getContent()); query.getConversation().setFirstMamReference(first == null ? null : first.getContent());
} }
if (complete || relevant == null || abort) { if (complete || relevant == null || abort) {
boolean done = !query.isCatchup(); boolean done;
if (count != null && !query.isCatchup()) { if (query.isCatchup()) {
try { done = false;
done = Integer.parseInt(count) <= query.getTotalCount(); } else {
} catch (NumberFormatException e) { if (count != null) {
done = false; try {
done = Integer.parseInt(count) <= query.getTotalCount();
} catch (NumberFormatException e) {
done = false;
}
} else {
done = query.getTotalCount() == 0;
} }
} }
done = done || (query.getActualMessageCount() == 0 && !query.isCatchup()); done = done || (query.getActualMessageCount() == 0 && !query.isCatchup());