fix 'connected' and 'authenticated' assignments

fork
mscdex 12 years ago
parent 33fbc905af
commit 4e0e7436e3

@ -133,15 +133,15 @@ ImapConnection.prototype.connect = function(loginCb) {
function onconnect() { function onconnect() {
state.conn = socket; // re-assign for secure connections state.conn = socket; // re-assign for secure connections
state.connected = true; self.connected = true;
state.authenticated = false; self.authenticated = false;
self.debug&&self.debug('[connection] Connected to host.'); self.debug&&self.debug('[connection] Connected to host.');
state.status = STATES.NOAUTH; state.status = STATES.NOAUTH;
}; };
state.conn.on('end', function() { state.conn.on('end', function() {
state.connected = false; self.connected = false;
state.authenticated = false; self.authenticated = false;
self.debug&&self.debug('[connection] FIN packet received. Disconnecting...'); self.debug&&self.debug('[connection] FIN packet received. Disconnecting...');
clearTimeout(state.tmrConn); clearTimeout(state.tmrConn);
self.emit('end'); self.emit('end');
@ -150,8 +150,8 @@ ImapConnection.prototype.connect = function(loginCb) {
state.conn.on('close', function(had_error) { state.conn.on('close', function(had_error) {
self._reset(); self._reset();
requests = state.requests; requests = state.requests;
state.connected = false; self.connected = false;
state.authenticated = false; self.authenticated = false;
self.debug&&self.debug('[connection] Connection closed.'); self.debug&&self.debug('[connection] Connection closed.');
self.emit('close', had_error); self.emit('close', had_error);
}); });
@ -570,7 +570,7 @@ ImapConnection.prototype.connect = function(loginCb) {
break; break;
case 'PREAUTH': case 'PREAUTH':
state.status = STATES.AUTH; state.status = STATES.AUTH;
state.authenticated = true; self.authenticated = true;
if (state.numCapRecvs === 0) if (state.numCapRecvs === 0)
state.numCapRecvs = 1; state.numCapRecvs = 1;
break; break;
@ -1423,7 +1423,7 @@ ImapConnection.prototype._login = function(cb) {
fnReturn = function(err) { fnReturn = function(err) {
if (!err) { if (!err) {
self._state.status = STATES.AUTH; self._state.status = STATES.AUTH;
self._state.authenticated = true; self.authenticated = true;
if (self._state.numCapRecvs !== 2) { if (self._state.numCapRecvs !== 2) {
// fetch post-auth server capabilities if they were not // fetch post-auth server capabilities if they were not
// automatically provided after login // automatically provided after login

Loading…
Cancel
Save