diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index 66fc4e9ddb..e7422cf9d8 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -2617,7 +2617,7 @@ class Core { EntityOperation.queue(context, message, EntityOperation.MOVE, trash.id); } } else { - int old = db.message().deleteMessagesBefore(folder.id, keep_time, delete_unseen); + int old = db.message().deleteMessagesBefore(folder.id, sync_time, keep_time, delete_unseen); Log.i(folder.name + " local old=" + old); } diff --git a/app/src/main/java/eu/faircode/email/DaoMessage.java b/app/src/main/java/eu/faircode/email/DaoMessage.java index b9d3a30ea6..13c0b02eb8 100644 --- a/app/src/main/java/eu/faircode/email/DaoMessage.java +++ b/app/src/main/java/eu/faircode/email/DaoMessage.java @@ -862,11 +862,11 @@ public interface DaoMessage { @Query("DELETE 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 stored < :before" + // moved, browsed + " AND stored < :sync_time" + // moved, browsed " AND ui_snoozed IS NULL") - int deleteMessagesBefore(long folder, long before, boolean unseen); + int deleteMessagesBefore(long folder, long sync_time, long keep_time, boolean unseen); } \ No newline at end of file