fix double emit on fetch()

fork
Brian White 12 years ago
parent 3bc7bd7ac2
commit f107a86f10

@ -248,13 +248,15 @@ ImapConnection.prototype.connect = function(loginCb) {
if (indata.expect > -1) {
if ((m = /\* (\d+) FETCH/i.exec(indata.line))
&& /^BODY\[/i.test(litType)) {
msg = new ImapMessage();
msg.seqno = parseInt(m[1], 10);
requests[0].msg = msg;
if (!requests[0].msg) {
msg = new ImapMessage();
msg.seqno = parseInt(m[1], 10);
requests[0].msg = msg;
var fetches = requests[0].fetchers[litType];
for (var f = 0, lenf = fetches.length; f < lenf; ++f)
fetches[f].emit('message', msg);
}
requests[0].key = litType;
var fetches = requests[0].fetchers[litType];
for (var f = 0, lenf = fetches.length; f < lenf; ++f)
fetches[f].emit('message', msg);
indata.streaming = (!RE_ISHEADER.test(litType));
if (indata.streaming)
indata.literals.push(indata.expect);

Loading…
Cancel
Save