diff --git a/lib/handlers/on-copy.js b/lib/handlers/on-copy.js index 77f00376..41d1c9e1 100644 --- a/lib/handlers/on-copy.js +++ b/lib/handlers/on-copy.js @@ -180,7 +180,11 @@ async function copyHandler(server, messageHandler, connection, mailbox, update, messageData.rdate = Date.now() + (targetData.retention || 0); messageData.modseq = modifyIndex; // reset message modseq to whatever it is for the mailbox right now - messageData.searchable = true; + if (!message.flags.includes('\\Deleted')) { + messageData.searchable = true; + } else { + delete messageData.searchable; + } let junk = false; if (targetData.specialUse === '\\Junk' && !messageData.junk) { diff --git a/lib/message-handler.js b/lib/message-handler.js index f6a4b4a0..dd397f63 100644 --- a/lib/message-handler.js +++ b/lib/message-handler.js @@ -415,7 +415,7 @@ class MessageHandler { messageData.uid = mailboxData.uidNext; messageData.modseq = mailboxData.modifyIndex + 1; - if (!['\\Junk', '\\Trash'].includes(mailboxData.specialUse) && !flags.includes('\\Deleted')) { + if (!flags.includes('\\Deleted')) { messageData.searchable = true; } @@ -862,7 +862,11 @@ class MessageHandler { let unseen = message.unseen; - message.searchable = true; + if (!message.flags.includes('\\Deleted')) { + messageData.searchable = true; + } else { + delete messageData.searchable; + } let junk = false; if (targetData.specialUse === '\\Junk' && !message.junk) { diff --git a/package.json b/package.json index 5a8924b0..a3ff5ea7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wildduck", - "version": "1.29.0", + "version": "1.29.1", "description": "IMAP/POP3 server built with Node.js and MongoDB", "main": "server.js", "scripts": {