fix fetch() options a bit and don't default to fetching body structure

fork
Brian White 12 years ago
parent b4051174df
commit 6c3d6568c5

@ -554,7 +554,7 @@ Valid `options` are:
* **markSeen** - < _boolean_ > - Mark message(s) as read when fetched. **Default:** false * **markSeen** - < _boolean_ > - Mark message(s) as read when fetched. **Default:** false
* **struct** - < _boolean_ > - Fetch the message structure. **Default:** true * **struct** - < _boolean_ > - Fetch the message structure. **Default:** false
* **size** - < _boolean_ > - Fetch the RFC822 size. **Default:** false * **size** - < _boolean_ > - Fetch the RFC822 size. **Default:** false

@ -928,19 +928,14 @@ ImapConnection.prototype._fetch = function(which, uids, options, what, cb) {
var toFetch = '', prefix, extensions, self = this, var toFetch = '', prefix, extensions, self = this,
parse = true, headers, key, stream, parse = true, headers, key, stream,
opts = { markSeen: false, struct: true, size: false },
fetchers = {}; fetchers = {};
if (typeof what === 'function') { if (typeof what === 'function') {
cb = what; cb = what;
what = options; what = options;
} else { options = {};
if (options.markSeen)
opts.markSeen = true;
if (options.size)
opts.size = true;
} }
prefix = (opts.markSeen ? ' BODY.PEEK[' : ' BODY['); 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) {

Loading…
Cancel
Save