diff options
Diffstat (limited to 'src/main/java/eu/siacs/conversations/services')
-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 | 7 |
2 files changed, 11 insertions, 6 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java b/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java index 276890271..1d80690c8 100644 --- a/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java +++ b/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java @@ -9,6 +9,7 @@ import java.util.Iterator; import java.util.List; import eu.siacs.conversations.Config; +import eu.siacs.conversations.R; import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.generator.AbstractGenerator; @@ -217,7 +218,7 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded { public class Query { private int totalCount = 0; - private int count = 0; + private int messageCount = 0; private long start; private long end; private Jid with = null; @@ -295,7 +296,10 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded { public void callback() { if (this.callback != null) { - this.callback.onMoreMessagesLoaded(count,conversation); + this.callback.onMoreMessagesLoaded(messageCount,conversation); + if (messageCount==0) { + this.callback.informUser(R.string.no_more_history_on_server); + } } } @@ -316,7 +320,7 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded { } public void incrementMessageCount() { - this.count++; + this.messageCount++; } public int getTotalCount() { diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index e66f71107..39babecea 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -962,12 +962,13 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa } public void loadMoreMessages(final Conversation conversation, final long timestamp, final OnMoreMessagesLoaded callback) { + Log.d(Config.LOGTAG,"load more messages for "+conversation.getName() + " prior to "+MessageGenerator.getTimestamp(timestamp)); + if (XmppConnectionService.this.getMessageArchiveService().queryInProgress(conversation)) { + return; + } new Thread(new Runnable() { @Override public void run() { - if (XmppConnectionService.this.getMessageArchiveService().queryInProgress(conversation)) { - return; - } final Account account = conversation.getAccount(); List<Message> messages = databaseBackend.getMessages(conversation, 50,timestamp); if (messages.size() > 0) { |