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

fork
mscdex 12 years ago
parent 318d01f177
commit da6eac3a6a

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

Loading…
Cancel
Save