From 4e0e7436e39287a4e6876235fe028ac600eb2482 Mon Sep 17 00:00:00 2001 From: mscdex Date: Sun, 10 Mar 2013 09:50:02 -0400 Subject: [PATCH] fix 'connected' and 'authenticated' assignments --- lib/imap.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/imap.js b/lib/imap.js index 7c9d3e7..dfdb9ac 100644 --- a/lib/imap.js +++ b/lib/imap.js @@ -133,15 +133,15 @@ ImapConnection.prototype.connect = function(loginCb) { function onconnect() { state.conn = socket; // re-assign for secure connections - state.connected = true; - state.authenticated = false; + self.connected = true; + self.authenticated = false; self.debug&&self.debug('[connection] Connected to host.'); state.status = STATES.NOAUTH; }; state.conn.on('end', function() { - state.connected = false; - state.authenticated = false; + self.connected = false; + self.authenticated = false; self.debug&&self.debug('[connection] FIN packet received. Disconnecting...'); clearTimeout(state.tmrConn); self.emit('end'); @@ -150,8 +150,8 @@ ImapConnection.prototype.connect = function(loginCb) { state.conn.on('close', function(had_error) { self._reset(); requests = state.requests; - state.connected = false; - state.authenticated = false; + self.connected = false; + self.authenticated = false; self.debug&&self.debug('[connection] Connection closed.'); self.emit('close', had_error); }); @@ -570,7 +570,7 @@ ImapConnection.prototype.connect = function(loginCb) { break; case 'PREAUTH': state.status = STATES.AUTH; - state.authenticated = true; + self.authenticated = true; if (state.numCapRecvs === 0) state.numCapRecvs = 1; break; @@ -1423,7 +1423,7 @@ ImapConnection.prototype._login = function(cb) { fnReturn = function(err) { if (!err) { self._state.status = STATES.AUTH; - self._state.authenticated = true; + self.authenticated = true; if (self._state.numCapRecvs !== 2) { // fetch post-auth server capabilities if they were not // automatically provided after login