diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2017-05-04 23:11:46 +0300 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2017-05-04 23:11:46 +0300 |
commit | 404cf808b03b0e906c07865b8ff14bb159de7db5 (patch) | |
tree | 3a647d6ee80826d327ad06e57740ab42c5a7a189 /src | |
parent | f98888d796728b5ef1fea1ad1db19ca60df21fbc (diff) |
set catchup flag on mam only when doing that
Diffstat (limited to 'src')
5 files changed, 16 insertions, 14 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java b/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java index ddd32b665..7a77e2c64 100644 --- a/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java +++ b/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java @@ -67,7 +67,7 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded { List<Conversation> conversations = mXmppConnectionService.getConversations(); for (Conversation conversation : conversations) { if (conversation.getMode() == Conversation.MODE_SINGLE && conversation.getAccount() == account && startCatchup > conversation.getLastMessageTransmitted()) { - this.query(conversation,startCatchup); + this.query(conversation,startCatchup,true); } } query = new Query(account, startCatchup, endCatchup); @@ -83,11 +83,13 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded { if (conversation.getLastMessageTransmitted() < 0 && conversation.countMessages() == 0) { query(conversation, 0, - System.currentTimeMillis()); + System.currentTimeMillis(), + true); } else { query(conversation, conversation.getLastMessageTransmitted(), - System.currentTimeMillis()); + System.currentTimeMillis(), + true); } } @@ -95,19 +97,21 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded { if (conversation.getLastMessageTransmitted() < 0 && conversation.countMessages() == 0) { return query(conversation, 0, - System.currentTimeMillis()); + System.currentTimeMillis(), + false); } else { return query(conversation, conversation.getLastMessageTransmitted(), - conversation.getAccount().getXmppConnection().getLastSessionEstablished()); + conversation.getAccount().getXmppConnection().getLastSessionEstablished(), + false); } } - public Query query(final Conversation conversation, long end) { - return this.query(conversation,conversation.getLastMessageTransmitted(),end); + public Query query(final Conversation conversation, long end, boolean allowCatchup) { + return this.query(conversation,conversation.getLastMessageTransmitted(),end, allowCatchup); } - public Query query(Conversation conversation, long start, long end) { + public Query query(Conversation conversation, long start, long end, boolean allowCatchup) { synchronized (this.queries) { final Query query; final long startActual = Math.max(start,mXmppConnectionService.getAutomaticMessageDeletionDate()); @@ -121,7 +125,7 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded { this.queries.add(reverseCatchup); this.execute(reverseCatchup); } - query = new Query(conversation, maxCatchup, end); + query = new Query(conversation, maxCatchup, end, allowCatchup); } if (start > end) { return null; diff --git a/src/main/java/eu/siacs/conversations/services/NotificationService.java b/src/main/java/eu/siacs/conversations/services/NotificationService.java index c81860ac9..ae31f99f1 100644 --- a/src/main/java/eu/siacs/conversations/services/NotificationService.java +++ b/src/main/java/eu/siacs/conversations/services/NotificationService.java @@ -246,7 +246,6 @@ public class NotificationService { } public void updateNotification(final boolean notify) { - Log.d(Config.LOGTAG,"updateNotification("+Boolean.toString(notify)+")"); final NotificationManagerCompat notificationManager = NotificationManagerCompat.from(mXmppConnectionService); final SharedPreferences preferences = mXmppConnectionService.getPreferences(); diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index c61a52172..2f3318ff3 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -1647,7 +1647,7 @@ public class XmppConnectionService extends Service { && conversation.getLastClearHistory() == 0) { if ((conversation.getMode() == Conversation.MODE_SINGLE && account.getXmppConnection().getFeatures().mam()) || (conversation.getMode() == Conversation.MODE_MULTI && conversation.getMucOptions().mamSupport())) { - MessageArchiveService.Query query = getMessageArchiveService().query(conversation, 0, timestamp); + MessageArchiveService.Query query = getMessageArchiveService().query(conversation, 0, timestamp, false); if (query != null) { query.setCallback(callback); callback.informUser(R.string.fetching_history_from_server); @@ -1761,7 +1761,7 @@ public class XmppConnectionService extends Service { mMessageArchiveService.query(c); } else { if (query.getConversation() == null) { - mMessageArchiveService.query(c, query.getStart()); + mMessageArchiveService.query(c, query.getStart(),query.isCatchup()); } } } diff --git a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java index 7c05bd960..f7c4c7b2f 100644 --- a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java @@ -35,7 +35,6 @@ import java.util.List; import eu.siacs.conversations.Config; import eu.siacs.conversations.R; -import eu.siacs.conversations.crypto.PgpEngine; import eu.siacs.conversations.crypto.axolotl.AxolotlService; import eu.siacs.conversations.crypto.axolotl.FingerprintStatus; import eu.siacs.conversations.crypto.axolotl.XmppAxolotlSession; diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java index b04494f73..adc78aeb8 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java @@ -570,7 +570,7 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie timestamp = System.currentTimeMillis(); } conversation.messagesLoaded.set(true); - MessageArchiveService.Query query = activity.xmppConnectionService.getMessageArchiveService().query(conversation, 0, timestamp); + MessageArchiveService.Query query = activity.xmppConnectionService.getMessageArchiveService().query(conversation, 0, timestamp, false); if (query != null) { Toast.makeText(activity, R.string.fetching_history_from_server, Toast.LENGTH_LONG).show(); } else { |