From 562e5acedef22fc9e452cac1ec0b60989b44fe01 Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 21 Oct 2021 10:38:42 +0200 Subject: [PATCH] Cleanup attachments for IMAP only --- app/src/main/java/eu/faircode/email/DaoAttachment.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/DaoAttachment.java b/app/src/main/java/eu/faircode/email/DaoAttachment.java index ef9d9b7d5e..174943593d 100644 --- a/app/src/main/java/eu/faircode/email/DaoAttachment.java +++ b/app/src/main/java/eu/faircode/email/DaoAttachment.java @@ -120,15 +120,17 @@ public interface DaoAttachment { " SET available = 0" + " WHERE NOT (available IS 0)" + " AND EXISTS" + - " (SELECT * FROM attachment a" + + " (SELECT * FROM attachment AS a" + " JOIN message ON message.id = a.message" + " JOIN folder ON folder.id = message.folder" + + " JOIN account ON account.id = message.account" + " WHERE a.id = attachment.id" + " AND a.available" + " AND message.ui_seen" + " AND NOT message.ui_flagged" + " AND encryption IS NULL" + - " AND message.received < :now - (folder.sync_days + 1) * 24 * 3600 * 1000)") + " AND message.received < :now - (folder.sync_days + 1) * 24 * 3600 * 1000" + + " AND account.pop = " + EntityAccount.TYPE_IMAP + ")") int purge(long now); @Insert