diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/de/pixart/messenger/services/XmppConnectionService.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index 7c5d2b64d..708200355 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -1027,10 +1027,10 @@ public class XmppConnectionService extends Service { public void expireOldMessages(final boolean resetHasMessagesLeftOnServer) { mLastExpiryRun.set(SystemClock.elapsedRealtime()); - mDatabaseWriterExecutor.execute(() -> { + Runnable runnable = () -> { long timestamp = getAutomaticMessageDeletionDate(); if (timestamp > 0) { - databaseBackend.expireOldMessages(timestamp); + expireOldMessages(timestamp); synchronized (XmppConnectionService.this.conversations) { for (Conversation conversation : XmppConnectionService.this.conversations) { conversation.expireOldMessages(timestamp); @@ -1042,7 +1042,8 @@ public class XmppConnectionService extends Service { } updateConversationUi(); } - }); + }; + mDatabaseWriterExecutor.execute((runnable)); } public boolean hasInternetConnection() { @@ -1716,7 +1717,7 @@ public class XmppConnectionService extends Service { mLastExpiryRun.set(SystemClock.elapsedRealtime()); if (deletionDate > 0) { Log.d(Config.LOGTAG, "deleting messages that are older than " + AbstractGenerator.getTimestamp(deletionDate)); - databaseBackend.expireOldMessages(deletionDate); + expireOldMessages(deletionDate); } Log.d(Config.LOGTAG, "restoring roster..."); for (Account account : accounts) { @@ -4558,4 +4559,8 @@ public class XmppConnectionService extends Service { onStartCommand(intent, 0, 0); } } + + private void expireOldMessages(long timestamp) { + databaseBackend.expireOldMessages(timestamp); + } } |