From 7379c4f90e58ce932515144d4dfe9f75688e179e Mon Sep 17 00:00:00 2001 From: M66B Date: Tue, 8 Feb 2022 20:59:35 +0100 Subject: [PATCH] Auto delete browsed messages --- app/src/main/java/eu/faircode/email/Core.java | 2 +- app/src/main/java/eu/faircode/email/DaoMessage.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index 4f65cde0db..eefa2f930e 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -3168,7 +3168,7 @@ class Core { // Delete old local messages if (auto_delete) { - List tbds = db.message().getMessagesBefore(folder.id, keep_time, delete_unseen); + List tbds = db.message().getMessagesBefore(folder.id, sync_time, keep_time, delete_unseen); Log.i(folder.name + " local tbd=" + tbds.size()); EntityFolder trash = db.folder().getFolderByType(folder.account, EntityFolder.TRASH); for (Long tbd : tbds) { diff --git a/app/src/main/java/eu/faircode/email/DaoMessage.java b/app/src/main/java/eu/faircode/email/DaoMessage.java index 5b2d6c31ea..c41982d846 100644 --- a/app/src/main/java/eu/faircode/email/DaoMessage.java +++ b/app/src/main/java/eu/faircode/email/DaoMessage.java @@ -928,13 +928,13 @@ public interface DaoMessage { @Query("SELECT id FROM message" + " WHERE folder = :folder" + - " AND received < :before" + + " AND received < :keep_time" + " AND NOT uid IS NULL" + " AND (ui_seen OR :unseen)" + " AND NOT ui_flagged" + - " AND NOT ui_browsed" + + " AND stored < :sync_time" + // moved, browsed " AND ui_snoozed IS NULL") - List getMessagesBefore(long folder, long before, boolean unseen); + List getMessagesBefore(long folder, long sync_time, long keep_time, boolean unseen); @Query("DELETE FROM message" + " WHERE folder = :folder" +