|
|
@ -39,7 +39,8 @@ var CRLF = '\r\n',
|
|
|
|
// extension constants
|
|
|
|
// extension constants
|
|
|
|
var IDLE_NONE = 1,
|
|
|
|
var IDLE_NONE = 1,
|
|
|
|
IDLE_WAIT = 2,
|
|
|
|
IDLE_WAIT = 2,
|
|
|
|
IDLE_IDLING = 3;
|
|
|
|
IDLE_IDLING = 3,
|
|
|
|
|
|
|
|
IDLE_DONE = 4;
|
|
|
|
|
|
|
|
|
|
|
|
function ImapConnection(options) {
|
|
|
|
function ImapConnection(options) {
|
|
|
|
if (!(this instanceof ImapConnection))
|
|
|
|
if (!(this instanceof ImapConnection))
|
|
|
@ -763,9 +764,10 @@ ImapConnection.prototype.connect = function(loginCb) {
|
|
|
|
if (state.isIdle) {
|
|
|
|
if (state.isIdle) {
|
|
|
|
if (state.ext.idle.state === IDLE_IDLING) {
|
|
|
|
if (state.ext.idle.state === IDLE_IDLING) {
|
|
|
|
var timeDiff = Date.now() - state.ext.idle.timeStarted;
|
|
|
|
var timeDiff = Date.now() - state.ext.idle.timeStarted;
|
|
|
|
if (timeDiff >= state.ext.idle.MAX_WAIT)
|
|
|
|
if (timeDiff >= state.ext.idle.MAX_WAIT) {
|
|
|
|
|
|
|
|
state.ext.idle.state = IDLE_DONE;
|
|
|
|
self._send('DONE');
|
|
|
|
self._send('DONE');
|
|
|
|
else
|
|
|
|
} else
|
|
|
|
state.tmrKeepalive = setTimeout(idleHandler, state.tmoKeepalive);
|
|
|
|
state.tmrKeepalive = setTimeout(idleHandler, state.tmoKeepalive);
|
|
|
|
} else if (!self.serverSupports('IDLE'))
|
|
|
|
} else if (!self.serverSupports('IDLE'))
|
|
|
|
doKeepalive();
|
|
|
|
doKeepalive();
|
|
|
@ -1578,8 +1580,10 @@ ImapConnection.prototype._send = function(cmdstr, cb) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (idle.state !== IDLE_NONE && cmdstr !== 'DONE') {
|
|
|
|
if (idle.state !== IDLE_NONE && cmdstr !== 'DONE') {
|
|
|
|
if (cmdstr !== undefined)
|
|
|
|
if (cmdstr !== undefined && idle.state !== IDLE_DONE) {
|
|
|
|
|
|
|
|
idle.state = IDLE_DONE;
|
|
|
|
this._send('DONE');
|
|
|
|
this._send('DONE');
|
|
|
|
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|