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() {
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

Loading…
Cancel
Save