|
|
|
@ -961,19 +961,26 @@ ImapConnection.prototype._fetch = function(which, uids, options, what, cb) {
|
|
|
|
|
headers = wp.headers;
|
|
|
|
|
else if (typeof wp.headers === 'object') {
|
|
|
|
|
if (!Array.isArray(wp.headers.fields)
|
|
|
|
|
&& typeof wp.headers.fields !== 'string')
|
|
|
|
|
&& typeof wp.headers.fields !== 'string'
|
|
|
|
|
&& wp.headers.fields !== true)
|
|
|
|
|
throw new Error('Invalid `fields` property');
|
|
|
|
|
if (Array.isArray(wp.headers.fields))
|
|
|
|
|
headers = wp.headers.fields;
|
|
|
|
|
else if (wp.headers.fields === true)
|
|
|
|
|
headers = true;
|
|
|
|
|
else
|
|
|
|
|
headers = [wp.headers.fields];
|
|
|
|
|
if (wp.headers.parse === false)
|
|
|
|
|
parse = false;
|
|
|
|
|
} else
|
|
|
|
|
throw new Error('Invalid `headers` value: ' + wp.headers);
|
|
|
|
|
key += 'HEADER.FIELDS (';
|
|
|
|
|
key += headers.join(' ').toUpperCase();
|
|
|
|
|
key += ')]';
|
|
|
|
|
if (headers === true)
|
|
|
|
|
key += 'HEADER]';
|
|
|
|
|
else {
|
|
|
|
|
key += 'HEADER.FIELDS (';
|
|
|
|
|
key += headers.join(' ').toUpperCase();
|
|
|
|
|
key += ')]';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (wp.headersNot) {
|
|
|
|
|
key = pprefix.trim();
|
|
|
|
@ -984,19 +991,26 @@ ImapConnection.prototype._fetch = function(which, uids, options, what, cb) {
|
|
|
|
|
headers = wp.headersNot;
|
|
|
|
|
else if (typeof wp.headersNot === 'object') {
|
|
|
|
|
if (!Array.isArray(wp.headersNot.fields)
|
|
|
|
|
&& typeof wp.headersNot.fields !== 'string')
|
|
|
|
|
&& typeof wp.headersNot.fields !== 'string'
|
|
|
|
|
&& wp.headersNot.fields !== true)
|
|
|
|
|
throw new Error('Invalid `fields` property');
|
|
|
|
|
if (Array.isArray(wp.headersNot.fields))
|
|
|
|
|
headers = wp.headersNot.fields;
|
|
|
|
|
else if (wp.headersNot.fields)
|
|
|
|
|
headers = true;
|
|
|
|
|
else
|
|
|
|
|
headers = [wp.headersNot.fields];
|
|
|
|
|
if (wp.headersNot.parse === false)
|
|
|
|
|
parse = false;
|
|
|
|
|
} else
|
|
|
|
|
throw new Error('Invalid `headersNot` value: ' + wp.headersNot);
|
|
|
|
|
key += 'HEADER.FIELDS.NOT (';
|
|
|
|
|
key += headers.join(' ').toUpperCase();
|
|
|
|
|
key += ')]';
|
|
|
|
|
if (headers === true)
|
|
|
|
|
key += 'HEADER]';
|
|
|
|
|
else {
|
|
|
|
|
key += 'HEADER.FIELDS.NOT (';
|
|
|
|
|
key += headers.join(' ').toUpperCase();
|
|
|
|
|
key += ')]';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (key) {
|
|
|
|
|