Keep attachments of unread/flagged messages

This commit is contained in:
M66B 2020-04-16 19:37:02 +02:00
parent f0bcd619d3
commit 1b0af321f7
2 changed files with 5 additions and 7 deletions

View File

@ -105,11 +105,10 @@ public interface DaoAttachment {
" JOIN folder ON folder.id = message.folder" +
" WHERE a.id = attachment.id" +
" AND a.available" +
" AND (message.stored < :now - folder.sync_days * 24 * 3600 * 1000" +
" OR (:extra AND" +
" (folder.type = '" + EntityFolder.TRASH + "'" +
" OR folder.type = '" + EntityFolder.JUNK + "'))))")
int purge(long now, boolean extra);
" AND message.ui_seen" +
" AND NOT message.ui_flagged" +
" AND message.received < :now - (folder.sync_days + 1) * 24 * 3600 * 1000)")
int purge(long now);
@Insert
long insertAttachment(EntityAttachment attachment);

View File

@ -107,8 +107,7 @@ public class WorkerCleanup extends Worker {
// Delete old attachments
if (cleanup_attachments) {
int purged = db.attachment().purge(
new Date().getTime(), BuildConfig.DEBUG);
int purged = db.attachment().purge(new Date().getTime());
Log.i("Attachments purged=" + purged);
}