diff options
author | Christian Schneppe <christian@pix-art.de> | 2017-03-09 20:37:30 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2017-03-09 20:37:30 +0100 |
commit | e67f7ecb404331bc660dadbce13505aab8f66eb0 (patch) | |
tree | 4ddb528b3eb64700408eee0f427cf04037af2e46 /src/main/java/de/pixart/messenger | |
parent | 63ceb05b3421eb8bd011645fd80620b4f694b916 (diff) |
set last clear date to time of last message
Diffstat (limited to 'src/main/java/de/pixart/messenger')
-rw-r--r-- | src/main/java/de/pixart/messenger/services/XmppConnectionService.java | 8 |
1 files changed, 7 insertions, 1 deletions
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() { |