diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2015-08-30 11:24:37 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2015-08-30 11:24:37 +0200 |
commit | b0c19d6bac396b5f30432a8ea5e1ef5e89a89048 (patch) | |
tree | 5eeba1b95be94e15fe3bdce55d37d28beda40706 /src/main/java/eu/siacs/conversations/services | |
parent | 8f4b7686c94c52563c29f100cd25599ac08a7bb2 (diff) |
fixed bug that prevented newly opened conversations to load the entire history via mam. fixes #1328
Diffstat (limited to '')
-rw-r--r-- | src/main/java/eu/siacs/conversations/services/MessageArchiveService.java | 10 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/services/XmppConnectionService.java | 1 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java b/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java index a31848a7..351ded0b 100644 --- a/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java +++ b/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java @@ -68,7 +68,15 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded { } public Query query(final Conversation conversation) { - return query(conversation,conversation.getAccount().getXmppConnection().getLastSessionEstablished()); + if (conversation.getLastMessageTransmitted() < 0 && conversation.countMessages() == 0) { + return query(conversation, + 0, + System.currentTimeMillis()); + } else { + return query(conversation, + conversation.getLastMessageTransmitted(), + conversation.getAccount().getXmppConnection().getLastSessionEstablished()); + } } public Query query(final Conversation conversation, long end) { diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 4edaa324..8de16058 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -2545,6 +2545,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa public void clearConversationHistory(final Conversation conversation) { conversation.clearMessages(); conversation.setHasMessagesLeftOnServer(false); //avoid messages getting loaded through mam + conversation.resetLastMessageTransmitted(); new Thread(new Runnable() { @Override public void run() { |