Comparing version 0.8.8 to 0.8.9
@@ -60,2 +60,3 @@ var tls = require('tls'), | ||
connTimeout: config.connTimeout || 10000, | ||
authTimeout: config.authTimeout || 5000, | ||
keepalive: (typeof config.keepalive === 'boolean' | ||
@@ -69,2 +70,3 @@ ? config.keepalive | ||
this._tmrConn = undefined; | ||
this._tmrAuth = undefined; | ||
this._queue = []; | ||
@@ -92,2 +94,3 @@ this._box = undefined; | ||
this._tmrConn = undefined; | ||
this._tmrAuth = undefined; | ||
this._queue = []; | ||
@@ -121,2 +124,8 @@ this._box = undefined; | ||
self.debug && self.debug('[connection] Connected to host'); | ||
self._tmrAuth = setTimeout(function() { | ||
var err = new Error('Timed out while authenticating with server'); | ||
err.source = 'timeout-auth'; | ||
self.emit('error', err); | ||
socket.destroy(); | ||
}, config.authTimeout); | ||
} | ||
@@ -126,2 +135,3 @@ | ||
clearTimeout(self._tmrConn); | ||
clearTimeout(self._tmrAuth); | ||
clearTimeout(self._tmrKeepalive); | ||
@@ -136,2 +146,3 @@ self.debug && self.debug('[connection] Error: ' + err); | ||
clearTimeout(self._tmrConn); | ||
clearTimeout(self._tmrAuth); | ||
clearTimeout(self._tmrKeepalive); | ||
@@ -145,2 +156,3 @@ self.state = 'disconnected'; | ||
clearTimeout(self._tmrConn); | ||
clearTimeout(self._tmrAuth); | ||
clearTimeout(self._tmrKeepalive); | ||
@@ -776,3 +788,3 @@ self.state = 'disconnected'; | ||
for (i = 0, len = bodies.length; i < len; ++i) { | ||
fetching.push(parseExpr(bodies[i])); | ||
fetching.push(parseExpr(''+bodies[i])); | ||
cmd += ' BODY' + prefix + '[' + bodies[i] + ']'; | ||
@@ -1210,2 +1222,3 @@ } | ||
clearTimeout(this._tmrConn); | ||
clearTimeout(this._tmrAuth); | ||
var err = new Error('Received negative welcome: ' + info.text); | ||
@@ -1292,5 +1305,5 @@ err.source = 'protocol'; | ||
for (var i = 0, len = SPECIAL_USE_ATTRIBUTES.length; i < len; ++i) | ||
if (box['attribs'].indexOf(SPECIAL_USE_ATTRIBUTES[i]) > -1) | ||
box['special_use_attrib'] = SPECIAL_USE_ATTRIBUTES[i]; | ||
for (i = 0, len = SPECIAL_USE_ATTRIBUTES.length; i < len; ++i) | ||
if (box.attribs.indexOf(SPECIAL_USE_ATTRIBUTES[i]) > -1) | ||
box.special_use_attrib = SPECIAL_USE_ATTRIBUTES[i]; | ||
@@ -1536,2 +1549,3 @@ var name = info.text.name, | ||
var reentry = function(err) { | ||
clearTimeout(self._tmrAuth); | ||
if (err) { | ||
@@ -1538,0 +1552,0 @@ self.emit('error', err); |
@@ -164,2 +164,3 @@ var EventEmitter = require('events').EventEmitter, | ||
Parser.prototype._resTagged = function() { | ||
var m; | ||
if (m = RE_LITERAL.exec(this._buffer)) { | ||
@@ -169,19 +170,14 @@ // non-BODY literal -- buffer it | ||
this._literallen = parseInt(m[1], 10); | ||
} else { | ||
var m = RE_TAGGED.exec(this._buffer), | ||
tagnum = parseInt(m[1], 10), | ||
type = m[2].toLowerCase(), | ||
textCode = (m[3] ? parseTextCode(m[3], this._literals) : m[3]), | ||
text = m[4]; | ||
} else if (m = RE_TAGGED.exec(this._buffer)) { | ||
this._buffer = ''; | ||
this._literals = []; | ||
this.emit('tagged', { | ||
type: type, | ||
tagnum: tagnum, | ||
textCode: textCode, | ||
text: text | ||
type: m[2].toLowerCase(), | ||
tagnum: parseInt(m[1], 10), | ||
textCode: (m[3] ? parseTextCode(m[3], this._literals) : m[3]), | ||
text: m[4] | ||
}); | ||
} | ||
} else | ||
this._buffer = ''; | ||
}; | ||
@@ -287,5 +283,11 @@ | ||
textCode, | ||
text = m[2]; | ||
text; | ||
this._buffer = ''; | ||
if (!m) | ||
return; | ||
text = m[2]; | ||
if (m[1] !== undefined) | ||
@@ -292,0 +294,0 @@ textCode = parseTextCode(m[1], this._literals); |
{ "name": "imap", | ||
"version": "0.8.8", | ||
"version": "0.8.9", | ||
"author": "Brian White <mscdex@mscdex.net>", | ||
@@ -4,0 +4,0 @@ "description": "An IMAP module for node.js that makes communicating with IMAP servers easy", |
@@ -397,2 +397,3 @@ Description | ||
* **connTimeout** - _integer_ - Number of milliseconds to wait for a connection to be established. **Default:** 10000 | ||
* **authTimeout** - _integer_ - Number of milliseconds to wait to be authenticated after a connection has been established. **Default:** 5000 | ||
* **keepalive** - _boolean_ - Enable the keepalive mechanism. **Default:** true | ||
@@ -399,0 +400,0 @@ * **debug** - _function_ - If set, the function will be called with one argument, a string containing some debug info **Default:** (no debug output) |
783819
7940
754