From e67f7ecb404331bc660dadbce13505aab8f66eb0 Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Thu, 9 Mar 2017 20:37:30 +0100 Subject: set last clear date to time of last message --- .../java/de/pixart/messenger/services/XmppConnectionService.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/main/java') diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index 4c6dd9ccd..a97a0d78b 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -3733,9 +3733,15 @@ public class XmppConnectionService extends Service { } public void clearConversationHistory(final Conversation conversation) { + long clearDate; + if (conversation.countMessages() > 0) { + clearDate = conversation.getLatestMessage().getTimeSent() + 1000; + } else { + clearDate = System.currentTimeMillis(); + } conversation.clearMessages(); conversation.setHasMessagesLeftOnServer(false); //avoid messages getting loaded through mam - conversation.setLastClearHistory(System.currentTimeMillis()); + conversation.setLastClearHistory(clearDate); Runnable runnable = new Runnable() { @Override public void run() { -- cgit v1.2.3