diff --git a/lib/imap-flow.js b/lib/imap-flow.js index e08cd5e..fc20828 100644 --- a/lib/imap-flow.js +++ b/lib/imap-flow.js @@ -1992,6 +1992,7 @@ class ImapFlow extends EventEmitter { * @property {String} [keyword] Matches messages that have the custom flag set * @property {String} [unKeyword] Matches messages that do not have the custom flag set * @property {Object.} [header] Matches messages with header key set if value is `true` (**NB!** not supported by all servers) or messages where header partially matches a string value + * @property {SearchObject} [not] A {@link SearchObject} object. It must not match. * @property {SearchObject[]} [or] An array of 2 or more {@link SearchObject} objects. At least on of these must match */ diff --git a/lib/search-compiler.js b/lib/search-compiler.js index 1ddf17c..f4a3b22 100644 --- a/lib/search-compiler.js +++ b/lib/search-compiler.js @@ -190,6 +190,19 @@ module.exports.searchCompiler = (connection, query) => { } break; + case 'NOT': + { + if (!params[term]) { + break; + } + + if (typeof params[term] === 'object') { + attributes.push({ type: 'ATOM', value: 'NOT' }); + walk(params[term]); + } + } + break; + case 'OR': { if (!params[term] || !Array.isArray(params[term]) || !params[term].length) {