From 6c3d6568c57bb7b0085e7659144be07fc80dd885 Mon Sep 17 00:00:00 2001 From: Brian White Date: Mon, 7 Jan 2013 05:29:29 -0500 Subject: [PATCH] fix fetch() options a bit and don't default to fetching body structure --- README.md | 2 +- lib/imap.js | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 92c24f2..7bcfde6 100644 --- a/README.md +++ b/README.md @@ -554,7 +554,7 @@ Valid `options` are: * **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 diff --git a/lib/imap.js b/lib/imap.js index 385a1e9..29b65e5 100644 --- a/lib/imap.js +++ b/lib/imap.js @@ -928,19 +928,14 @@ ImapConnection.prototype._fetch = function(which, uids, options, what, cb) { var toFetch = '', prefix, extensions, self = this, parse = true, headers, key, stream, - opts = { markSeen: false, struct: true, size: false }, fetchers = {}; if (typeof what === 'function') { cb = what; what = options; - } else { - if (options.markSeen) - opts.markSeen = true; - if (options.size) - opts.size = true; + options = {}; } - prefix = (opts.markSeen ? ' BODY.PEEK[' : ' BODY['); + prefix = (options.markSeen ? ' BODY.PEEK[' : ' BODY['); if (!Array.isArray(what)) what = [what]; for (var i = 0, wp, pprefix, len = what.length; i < len; ++i) {