From 0a8a4d5294f6c3291ddc96efc84c88f4207bece9 Mon Sep 17 00:00:00 2001 From: mscdex Date: Mon, 20 May 2013 22:54:12 -0400 Subject: [PATCH] check for additional data after IDLE/NOOP responses --- lib/imap.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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