don't include ".PEEK" in fetch keys, only in command where applicable

fork
mscdex 11 years ago
parent 318d01f177
commit da6eac3a6a

@ -925,7 +925,7 @@ ImapConnection.prototype._fetch = function(which, uids, options, what, cb) {
uids = [uids];
utils.validateUIDList(uids);
var toFetch = '', prefix, extensions, self = this,
var toFetch = '', prefix = ' BODY[', extensions, self = this,
parse = true, headers, key, stream,
fetchers = {};
@ -934,9 +934,9 @@ ImapConnection.prototype._fetch = function(which, uids, options, what, cb) {
what = options;
options = {};
}
prefix = (options.markSeen ? ' BODY.PEEK[' : ' BODY[');
if (!Array.isArray(what))
what = [what];
for (var i = 0, wp, pprefix, len = what.length; i < len; ++i) {
wp = what[i];
if (wp.id !== undefined && !/^(?:[\d]+[\.]{0,1})*[\d]+$/.test(''+wp.id))
@ -1117,8 +1117,12 @@ ImapConnection.prototype._fetch = function(which, uids, options, what, cb) {
cmd += ' BODYSTRUCTURE';
if (options.size)
cmd += ' RFC822.SIZE';
if (toFetch)
cmd += toFetch;
if (toFetch) {
if (!options.markSeen)
cmd += toFetch.replace(/BODY\[/g, 'BODY.PEEK[');
else
cmd += toFetch;
}
cmd += ')';
this._send(cmd, function(err) {

Loading…
Cancel
Save