From 144bd41170652514ae26666507a05c247a3e29fc Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 11 Feb 2019 21:21:06 +0000 Subject: [PATCH] POP delete --- .../eu/faircode/email/ServiceSynchronize.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java index 76f1c93dd1..762d15e960 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java +++ b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java @@ -1917,11 +1917,21 @@ public class ServiceSynchronize extends LifecycleService { if (TextUtils.isEmpty(message.msgid)) throw new IllegalArgumentException("Message ID missing"); - Message[] imessages = ifolder.search(new MessageIDTerm(message.msgid)); + boolean found = false; + Message[] imessages = ifolder.getMessages(); for (Message imessage : imessages) { - Log.i(folder.name + " deleting uid=" + message.uid + " msgid=" + message.msgid); - imessage.setFlag(Flags.Flag.DELETED, true); + MessageHelper helper = new MessageHelper((MimeMessage) imessage); + String msgid = helper.getMessageID(); + if (message.msgid.equals(msgid)) { + found = true; + imessage.setFlag(Flags.Flag.DELETED, true); + break; + } } + + if (!found) + throw new MessageRemovedException(); + ifolder.close(); ifolder.open(Folder.READ_WRITE); } @@ -2384,6 +2394,8 @@ public class ServiceSynchronize extends LifecycleService { List messages = db.message().getMessageByMsgId(folder.account, msgid); if (messages.size() > 0) { + for (EntityMessage message : messages) + db.message().setMessageUiHide(message.id, false); Log.i(folder.name + " POP having=" + msgid); continue; }