node-imap
node-imap copied to clipboard
In fetch criteria, ORs cannot be nested
Example: Fetching mail from a list of addresses, where FROM can be [email protected], [email protected], [email protected].
Entering this as ['OR', ['[email protected]', '[email protected]', '[email protected]']] fails, as OR can only take two arguments. Entering this as nested OR also fails in parsing it to a criterion string.
Is there another way to include ORed lists?
faced the same issue and implemented a workaround as follows:
@@ -1830,7 +1830,7 @@ function buildSearchQuery(options, extensions, info, isOrChild) {
var searchargs = '', err, val;
for (var i = 0, len = options.length; i < len; ++i) {
var criteria = (isOrChild ? options : options[i]),
- args = null,
+ args = (isOrChild ? null : options.slice(1)),
modifier = (isOrChild ? '' : ' ');
if (typeof criteria === 'string')
criteria = criteria.toUpperCase();
aha, sorry.
-
args = (isOrChild ? null : options.slice(I+1)),
@Setogit Why not PR this?
Absolutely. Pull requested as make OR filter work #444