From 601e52f12912f41230575e9c4d3fef1cd485f6b0 Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 16 Aug 2024 12:21:52 +0200 Subject: [PATCH] JavaMail: fixed VANISH range --- app/src/main/java/com/sun/mail/imap/IMAPFolder.java | 5 +++-- app/src/main/java/com/sun/mail/imap/MessageCache.java | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/sun/mail/imap/IMAPFolder.java b/app/src/main/java/com/sun/mail/imap/IMAPFolder.java index d069f27921..0fc71205b3 100644 --- a/app/src/main/java/com/sun/mail/imap/IMAPFolder.java +++ b/app/src/main/java/com/sun/mail/imap/IMAPFolder.java @@ -3644,8 +3644,9 @@ public class IMAPFolder extends Folder implements UIDFolder, ResponseHandler { long[] luid = UIDSet.toArray(uidset); Message[] msgs = createMessagesForUIDs(luid); for (Message m : msgs) { - if (m.getMessageNumber() > 0) - messageCache.expungeMessage(m.getMessageNumber()); + // Avoid creating seqnums + if (m != null) + ((IMAPMessage)m).setExpunged(true); } if (doExpungeNotification && hasMessageCountListener) { notifyMessageRemovedListeners(true, msgs); diff --git a/app/src/main/java/com/sun/mail/imap/MessageCache.java b/app/src/main/java/com/sun/mail/imap/MessageCache.java index 93811849ac..62ccc4adb8 100644 --- a/app/src/main/java/com/sun/mail/imap/MessageCache.java +++ b/app/src/main/java/com/sun/mail/imap/MessageCache.java @@ -217,8 +217,8 @@ public class MessageCache { int newnum = 1; while (oldnum <= size) { // is message expunged? - if (seqnumOf(oldnum) <= 0) { IMAPMessage m = getMessage(oldnum); + if (seqnumOf(oldnum) <= 0 || (m !=null && m.isExpunged())) { mlist.add(m); } else { // keep this message