diff --git a/lib/imap.utilities.js b/lib/imap.utilities.js index b8bf7e0..9e8bfa7 100644 --- a/lib/imap.utilities.js +++ b/lib/imap.utilities.js @@ -365,7 +365,15 @@ exports.buildSearchQuery = function(options, extensions, isOrChild) { searchargs += modifier + criteria + ' ' + args[0]; break; default: - throw new Error('Unexpected search option: ' + criteria); + try { + // last hope it's a seqno set + // http://tools.ietf.org/html/rfc3501#section-6.4.4 + var seqnos = (args ? [criteria].concat(args) : [criteria]); + exports.validateUIDList(seqnos); + searchargs += modifier + seqnos.join(','); + } catch(e) { + throw new Error('Unexpected search option: ' + criteria); + } } } if (isOrChild)