diff --git a/lib/imap.js b/lib/imap.js index 07c8422..d600991 100644 --- a/lib/imap.js +++ b/lib/imap.js @@ -738,7 +738,11 @@ ImapConnection.prototype.connect = function(loginCb) { } else if (RE_RES_IDLE.test(indata.line)) { self.debug&&self.debug('[parsing incoming] saw IDLE'); requests.shift(); // remove IDLE request - indata.line = undefined; + var idx; + if ((idx = indata.line.indexOf(CRLF)) > -1) + indata.line = indata.line.substr(idx + 2); + else + indata.line = undefined; state.ext.idle.state = IDLE_NONE; state.ext.idle.timeStarted = undefined; if (requests.length) { @@ -749,6 +753,11 @@ ImapConnection.prototype.connect = function(loginCb) { } else if (RE_RES_NOOP.test(indata.line)) { self.debug&&self.debug('[parsing incoming] saw NOOP'); requests.shift(); // remove NOOP request + var idx; + if ((idx = indata.line.indexOf(CRLF)) > -1) + indata.line = indata.line.substr(idx + 2); + else + indata.line = undefined; if (!requests.length) doKeepaliveTimer(); else