From 977484ce7e69e9496a1c52f84e4139a37e04af0b Mon Sep 17 00:00:00 2001 From: mscdex Date: Sun, 30 Jun 2013 02:15:54 -0400 Subject: [PATCH] lint --- lib/Connection.js | 37 +++++++++++++++--------------- lib/Parser.js | 4 +--- test/test-connection-fetch-dup.js | 4 ++-- test/test-connection-fetch-frag.js | 4 ++-- 4 files changed, 24 insertions(+), 25 deletions(-) diff --git a/lib/Connection.js b/lib/Connection.js index 60373cf..a428da9 100644 --- a/lib/Connection.js +++ b/lib/Connection.js @@ -36,9 +36,7 @@ var MAX_INT = 9007199254740992, RE_INVALID_KW_CHARS = /[\(\)\{\\\"\]\%\*\x00-\x20\x7F]/, RE_NUM_RANGE = /^(?:[\d]+|\*):(?:[\d]+|\*)$/, RE_BACKSLASH = /\\/g, - RE_BACKSLASH_ESC = /\\\\/g, RE_DBLQUOTE = /"/g, - RE_DBLQUOTE_ESC = /\\"/g, RE_INTEGER = /^\d+$/; function Connection(config) { @@ -541,10 +539,10 @@ Connection.prototype._move = function(which, uids, boxTo, cb) { ccb(err, info); } } else if (task === 2) { - function cbMarkDel(e) { + var cbMarkDel = function(e) { ++task; ccb(e, info); - } + }; if (which) self.addFlags(uids, 'Deleted', cbMarkDel); else @@ -854,7 +852,7 @@ Connection.prototype.__defineGetter__('seq', function() { }); Connection.prototype._resUntagged = function(info) { - var type = info.type; + var type = info.type, i, len, box, attrs; if (type === 'bye') this._sock.end(); @@ -932,7 +930,7 @@ Connection.prototype._resUntagged = function(info) { this._box.keywords = keywords = permFlags.filter(function(f) { return (f[0] !== '\\'); }); - for (var i = 0, len = keywords.length; i < len; ++i) + for (i = 0, len = keywords.length; i < len; ++i) permFlags.splice(permFlags.indexOf(keywords[i]), 1); this._box.permFlags = permFlags.map(function(f) { return f.substr(1).toLowerCase(); @@ -946,7 +944,7 @@ Connection.prototype._resUntagged = function(info) { if (this._curReq.cbargs.length === 0) this._curReq.cbargs.push({}); - var box = { + box = { attribs: info.text.flags.map(function(attr) { return attr.substr(1); }).filter(function(attr) { @@ -955,15 +953,16 @@ Connection.prototype._resUntagged = function(info) { delimiter: info.text.delimiter, children: null, parent: null - }, - name = info.text.name, + }; + + var name = info.text.name, curChildren = this._curReq.cbargs[0]; if (box.delimiter) { var path = name.split(box.delimiter), parent = null; name = path.pop(); - for (var i = 0, len = path.length; i < len; ++i) { + for (i = 0, len = path.length; i < len; ++i) { if (!curChildren[path[i]]) curChildren[path[i]] = {}; if (!curChildren[path[i]].children) @@ -978,7 +977,7 @@ Connection.prototype._resUntagged = function(info) { curChildren[name] = box; } } else if (type === 'status') { - var box = { + box = { name: info.text.name, uidvalidity: 0, messages: { @@ -986,7 +985,8 @@ Connection.prototype._resUntagged = function(info) { new: 0, unseen: 0 } - }, attrs = info.text.attrs; + }; + attrs = info.text.attrs; if (attrs) { if (attrs.recent !== undefined) @@ -1003,7 +1003,7 @@ Connection.prototype._resUntagged = function(info) { var msg = this._curReq.fetchCache[info.num], keys = Object.keys(info.text), keyslen = keys.length, - attrs, toget, msgEmitter, i, j; + toget, msgEmitter, j; if (msg === undefined) { // simple case -- no bodies were streamed @@ -1069,7 +1069,7 @@ Connection.prototype._resTagged = function(info) { errtext = req.oauthError; else errtext = info.text; - var err = new Error(errtext); + err = new Error(errtext); err.textCode = info.textCode; err.source = 'protocol'; } else if (this._box) { @@ -1205,16 +1205,17 @@ Connection.prototype._login = function() { return reentry(err); } + var cmd; if (self.serverSupports('AUTH=XOAUTH') && self._config.xoauth) { self._caps = undefined; - var cmd = 'AUTHENTICATE XOAUTH'; + cmd = 'AUTHENTICATE XOAUTH'; // are there any servers that support XOAUTH/XOAUTH2 and not SASL-IR? //if (self.serverSupports('SASL-IR')) cmd += ' ' + escape(self._config.xoauth); self._enqueue(cmd, checkCaps); } else if (self.serverSupports('AUTH=XOAUTH2') && self._config.xoauth2) { self._caps = undefined; - var cmd = 'AUTHENTICATE XOAUTH2'; + cmd = 'AUTHENTICATE XOAUTH2'; //if (self.serverSupports('SASL-IR')) cmd += ' ' + escape(self._config.xoauth2); self._enqueue(cmd, checkCaps); @@ -1246,8 +1247,8 @@ Connection.prototype._starttls = function() { var tlsOptions = {}; - for (var k in config.tlsOptions) - tlsOptions[k] = config.tlsOptions[k]; + for (var k in this._config.tlsOptions) + tlsOptions[k] = this._config.tlsOptions[k]; tlsOptions.socket = self._sock; self._sock = tls.connect(tlsOptions, function() { diff --git a/lib/Parser.js b/lib/Parser.js index c67e2ec..5502b9c 100644 --- a/lib/Parser.js +++ b/lib/Parser.js @@ -326,8 +326,7 @@ function parseQuota(text, literals) { } function parseQuotaRoot(text, literals) { - var r = parseExpr(text, literals), - roots = []; + var r = parseExpr(text, literals); return { roots: r.slice(1), @@ -651,7 +650,6 @@ function convStr(str, literals) { function parseHeader(str) { var lines = str.split(RE_CRLF), len = lines.length, - modded = false, header = {}, m, h; diff --git a/test/test-connection-fetch-dup.js b/test/test-connection-fetch-dup.js index a28f443..ff54abb 100644 --- a/test/test-connection-fetch-dup.js +++ b/test/test-connection-fetch-dup.js @@ -41,7 +41,7 @@ var srv = net.createServer(function(sock) { if (buf.indexOf(CRLF) > -1) { lines = buf.split(CRLF); buf = lines.pop(); - lines.forEach(function(l) { + lines.forEach(function() { sock.write(RESPONSES.shift()); }); } @@ -56,7 +56,7 @@ srv.listen(0, '127.0.0.1', function() { port: port }); imap.on('ready', function() { - imap.openBox('INBOX', true, function(err, box) { + imap.openBox('INBOX', true, function() { var f = imap.seq.fetch(1); f.on('message', function(m) { m.once('attributes', function(attrs) { diff --git a/test/test-connection-fetch-frag.js b/test/test-connection-fetch-frag.js index 770a47d..46341ea 100644 --- a/test/test-connection-fetch-frag.js +++ b/test/test-connection-fetch-frag.js @@ -41,7 +41,7 @@ var srv = net.createServer(function(sock) { if (buf.indexOf(CRLF) > -1) { lines = buf.split(CRLF); buf = lines.pop(); - lines.forEach(function(l) { + lines.forEach(function() { sock.write(RESPONSES.shift()); }); } @@ -56,7 +56,7 @@ srv.listen(0, '127.0.0.1', function() { port: port }); imap.on('ready', function() { - imap.openBox('INBOX', true, function(err, box) { + imap.openBox('INBOX', true, function() { var f = imap.seq.fetch(1); f.on('message', function(m) { m.once('attributes', function(attrs) {