From 88d2dcaff4dbe54c56913d42f975236c8dc6dc2b Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 11 Nov 2019 14:44:05 +0100 Subject: [PATCH] Find POP3 delete --- app/src/main/java/eu/faircode/email/Core.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index 6a6f056261..3e09fd41b8 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -276,7 +276,7 @@ class Core { break; case EntityOperation.DELETE: - onDelete(context, jargs, account, folder, message, (POP3Folder) ifolder, state); + onDelete(context, jargs, account, folder, message, (POP3Folder) ifolder, (POP3Store) istore, state); break; case EntityOperation.SYNC: @@ -986,18 +986,27 @@ class Core { } } - private static void onDelete(Context context, JSONArray jargs, EntityAccount account, EntityFolder folder, EntityMessage message, POP3Folder ifolder, State state) throws MessagingException { + private static void onDelete(Context context, JSONArray jargs, EntityAccount account, EntityFolder folder, EntityMessage message, POP3Folder ifolder, POP3Store istore, State state) throws MessagingException { // Delete message DB db = DB.getInstance(context); if (!account.browse && EntityFolder.INBOX.equals(folder.type)) { + Map caps = istore.capabilities(); + Message[] imessages = ifolder.getMessages(); Log.i(folder.name + " POP messages=" + imessages.length); boolean found = false; for (Message imessage : imessages) { MessageHelper helper = new MessageHelper((MimeMessage) imessage); - String msgid = helper.getMessageID(); + + String msgid; + if (caps.containsKey("UIDL")) + msgid = ifolder.getUID(imessage); + else + msgid = helper.getMessageID(); + + Log.i("POP searching=" + message.msgid + " iterate=" + msgid); if (msgid != null && msgid.equals(message.msgid)) { found = true; Log.i(folder.name + " POP delete=" + msgid);