Use string.indexOf() since we already have a stringified version of the response chunk

fork
Brian White 12 years ago
parent 4f8fbcbe01
commit 21e50a9887

@ -16,7 +16,7 @@ var CRLF = '\r\n',
BOXSELECTED: 4
},
BOX_ATTRIBS = ['NOINFERIORS', 'NOSELECT', 'MARKED', 'UNMARKED'],
RE_FETCH = /^\* (\d+) FETCH .+? \{(\d+)\}\r\n/;
REGEXP_FETCH = /^\* (\d+) FETCH .+? \{(\d+)\}\r\n/;
// extension constants
var IDLE_NONE = 1,
@ -239,15 +239,14 @@ ImapConnection.prototype.connect = function(loginCb) {
return;
} else
return;
} else if (self._state.curExpected === 0
&& (literalInfo = (strdata = data.toString()).match(RE_FETCH))) {
} else if (self._state.curExpected === 0 &&
(literalInfo = (strdata = data.toString()).match(REGEXP_FETCH))) {
self._state.curExpected = parseInt(literalInfo[2], 10);
var idxCRLF = utils.bufferIndexOf(data, CRLF),
var idxCRLF = strdata.indexOf(CRLF),
curReq = self._state.requests[0],
type = /BODY\[(.*)\](?:\<\d+\>)?/.exec(strdata.substring(0, idxCRLF)),
msg = new ImapMessage(),
desc = strdata.substring(utils.bufferIndexOf(data, '(') + 1, idxCRLF)
.trim();
desc = strdata.substring(strdata.indexOf('(') + 1, idxCRLF).trim();
msg.seqno = parseInt(literalInfo[1], 10);
type = type[1];
curReq._desc = desc;

Loading…
Cancel
Save