From ba75513ba1f2a70790f11b7bf7eb2a231fdb2a44 Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 12 Feb 2021 12:51:34 +0100 Subject: [PATCH] Added expunge operation --- FAQ.md | 1 + app/src/main/java/eu/faircode/email/Core.java | 9 +++++++++ app/src/main/java/eu/faircode/email/DaoOperation.java | 1 + app/src/main/java/eu/faircode/email/EntityOperation.java | 1 + 4 files changed, 12 insertions(+) diff --git a/FAQ.md b/FAQ.md index 88812abbbe..032d36098b 100644 --- a/FAQ.md +++ b/FAQ.md @@ -404,6 +404,7 @@ The low priority status bar notification shows the number of pending operations, * *send*: send message * *exists*: check if message exists * *rule*: execute rule on body text +* *expunge*: permanently delete messages Operations are processed only when there is a connection to the email server or when manually synchronizing. See also [this FAQ](#user-content-faq16). diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index aef9a9d40b..de8ced4c26 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -409,6 +409,10 @@ class Core { onPurgeFolder(context, jargs, folder, (IMAPFolder) ifolder); break; + case EntityOperation.EXPUNGE: + onExpungeFolder(context, jargs, folder, (IMAPFolder) ifolder); + break; + case EntityOperation.RULE: onRule(context, jargs, message); break; @@ -1999,6 +2003,11 @@ class Core { } } + private static void onExpungeFolder(Context context, JSONArray jargs, EntityFolder folder, IMAPFolder ifolder) throws MessagingException { + Log.i(folder.name + " expunge"); + ifolder.expunge(); + } + private static void onPurgeFolder(Context context, EntityFolder folder) { // POP3 DB db = DB.getInstance(context); diff --git a/app/src/main/java/eu/faircode/email/DaoOperation.java b/app/src/main/java/eu/faircode/email/DaoOperation.java index d09a20bb80..b7c1337005 100644 --- a/app/src/main/java/eu/faircode/email/DaoOperation.java +++ b/app/src/main/java/eu/faircode/email/DaoOperation.java @@ -43,6 +43,7 @@ public interface DaoOperation { " WHEN operation.name = '" + EntityOperation.MOVE + "' THEN 5" + " WHEN operation.name = '" + EntityOperation.PURGE + "' THEN 6" + " WHEN operation.name = '" + EntityOperation.DELETE + "' THEN 7" + + " WHEN operation.name = '" + EntityOperation.EXPUNGE + "' THEN 8" + " ELSE 0" + " END"; diff --git a/app/src/main/java/eu/faircode/email/EntityOperation.java b/app/src/main/java/eu/faircode/email/EntityOperation.java index 8b5cf27b0d..777cbd2f4d 100644 --- a/app/src/main/java/eu/faircode/email/EntityOperation.java +++ b/app/src/main/java/eu/faircode/email/EntityOperation.java @@ -100,6 +100,7 @@ public class EntityOperation { static final String EXISTS = "exists"; static final String RULE = "rule"; static final String PURGE = "purge"; + static final String EXPUNGE = "expunge"; private static final int MAX_FETCH = 100; // operations