From 502a2aaf4ba0d987a4cfa3aca0182bfcfe9c8b94 Mon Sep 17 00:00:00 2001 From: mscdex Date: Sun, 7 Apr 2013 23:31:30 -0400 Subject: [PATCH] fix fetch command check when determining a response was unsolicited --- lib/imap.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/imap.js b/lib/imap.js index 738d9d3..1520048 100644 --- a/lib/imap.js +++ b/lib/imap.js @@ -28,6 +28,7 @@ var CRLF = '\r\n', RE_TEXT_CODE = /([^ ]+)(?: (.*))?$/, RE_RES_IDLE = /^IDLE /i, RE_RES_NOOP = /^NOOP /i, + RE_CMD_FETCH = /^(?:UID )?FETCH/i, RE_PARTID = /^(?:[\d]+[\.]{0,1})*[\d]+$/, //RE_ISPARTIAL = /<(\d+)>$/, RE_DBLQ = /"/g, @@ -323,7 +324,8 @@ ImapConnection.prototype.connect = function(loginCb) { details, val; isUnsolicited = isUnsolicited - || (requests[0] && requests[0].cmd !== 'FETCH'); + || (requests[0] + && !RE_CMD_FETCH.test(requests[0].cmdstr)); if (!isUnsolicited) bodies = parsers.parseFetchBodies(m.info, indata.literals);