From 1815f9d5f861d3dd7af02cc10701878e72657dee Mon Sep 17 00:00:00 2001 From: mscdex Date: Wed, 12 Jun 2013 02:07:51 -0400 Subject: [PATCH] lint --- lib/imap.js | 61 +++++++++++++++++++++------------------------ lib/imap.parsers.js | 4 +-- 2 files changed, 31 insertions(+), 34 deletions(-) diff --git a/lib/imap.js b/lib/imap.js index ed7fb67..b1960c9 100644 --- a/lib/imap.js +++ b/lib/imap.js @@ -148,7 +148,7 @@ ImapConnection.prototype.connect = function(loginCb) { self.authenticated = false; self.debug&&self.debug('[connection] Connected to host.'); state.status = STATES.NOAUTH; - }; + } state.conn.on('end', function() { self.connected = false; @@ -255,7 +255,8 @@ ImapConnection.prototype.connect = function(loginCb) { if (b.length === 0 || b.p >= b.length) return; self.debug&&self.debug('\n<== ' + inspect(b.toString('binary', b.p)) + '\n'); - var r, m, litType, i, len, msg, fetches, f, lenf; + var r, m, litType, i, len, msg, fetches, index; + if (indata.expect > 0) { r = read(b); if (indata.streaming) { @@ -318,8 +319,7 @@ ImapConnection.prototype.connect = function(loginCb) { switch (m.type) { case 'FETCH': // m.info = message details - var data, parsed, headers, f, lenf, body, lenb, msg, bodies, - details, val; + var data, parsed, headers, body, lenb, bodies, details, val; isUnsolicited = isUnsolicited || (requests[0] @@ -334,7 +334,7 @@ ImapConnection.prototype.connect = function(loginCb) { if (details['x-gm-labels'] !== undefined) { var labels = details['x-gm-labels']; - for (var i=0, len=labels.length; i -1) - indata.line = indata.line.substr(idx + 2); + if ((index = indata.line.indexOf(CRLF)) > -1) + indata.line = indata.line.substr(index + 2); else indata.line = undefined; state.ext.idle.state = IDLE_NONE; @@ -753,9 +752,8 @@ ImapConnection.prototype.connect = function(loginCb) { } else if (RE_RES_NOOP.test(indata.line)) { self.debug&&self.debug('[parsing incoming] saw NOOP'); requests.shift(); // remove NOOP request - var idx; - if ((idx = indata.line.indexOf(CRLF)) > -1) - indata.line = indata.line.substr(idx + 2); + if ((index = indata.line.indexOf(CRLF)) > -1) + indata.line = indata.line.substr(index + 2); else indata.line = undefined; if (!requests.length) @@ -1020,8 +1018,7 @@ ImapConnection.prototype._fetch = function(which, uids, options, what, cb) { uids = [uids]; utils.validateUIDList(uids); - var toFetch = '', prefix = ' BODY[', extensions, self = this, - parse, headers, key, stream, + var toFetch = '', prefix = ' BODY[', extensions, parse, headers, key, stream, fetchers = {}; // argument detection! diff --git a/lib/imap.parsers.js b/lib/imap.parsers.js index fe58e41..f062abe 100644 --- a/lib/imap.parsers.js +++ b/lib/imap.parsers.js @@ -306,8 +306,8 @@ exports.parseStructExtra = function(part, partLen, cur, next) { exports.parseExpr = function(o, literals, result, start, useBrackets) { start = start || 0; - var inQuote = false, lastPos = start - 1, isTop = false, inLitStart = false, - val; + var inQuote = false, lastPos = start - 1, isTop = false, val; + if (useBrackets === undefined) useBrackets = true; if (!result)