|
|
|
@ -308,11 +308,15 @@ ImapConnection.prototype.connect = function(loginCb) {
|
|
|
|
|
// m.info = message details
|
|
|
|
|
var data, parsed, headers, f, lenf, body, lenb, msg, bodies,
|
|
|
|
|
details, val;
|
|
|
|
|
if (!isUnsolicited)
|
|
|
|
|
bodies = parsers.parseFetchBodies(m.info, indata.literals);
|
|
|
|
|
details = new ImapMessage();
|
|
|
|
|
parsers.parseFetch(m.info, indata.literals, details);
|
|
|
|
|
details.seqno = parseInt(m.num, 10);
|
|
|
|
|
|
|
|
|
|
if (isUnsolicited)
|
|
|
|
|
self.emit('msgupdate', details);
|
|
|
|
|
else {
|
|
|
|
|
if (requests[0].fetchers[''] !== undefined) {
|
|
|
|
|
// account for non-body fetches
|
|
|
|
|
if (bodies) {
|
|
|
|
@ -339,9 +343,7 @@ ImapConnection.prototype.connect = function(loginCb) {
|
|
|
|
|
// we streamed a body, e.g. {3}\r\nfoo
|
|
|
|
|
} else {
|
|
|
|
|
// no body was streamed
|
|
|
|
|
if (isUnsolicited)
|
|
|
|
|
self.emit('msgupdate', details);
|
|
|
|
|
else if (typeof val === 'string') {
|
|
|
|
|
if (typeof val === 'string') {
|
|
|
|
|
// a body was given as a non-literal string, e.g. "foo"
|
|
|
|
|
if (RE_ISHEADER.test(bodies[body])) {
|
|
|
|
|
var parsed, data, headers;
|
|
|
|
@ -371,6 +373,7 @@ ImapConnection.prototype.connect = function(loginCb) {
|
|
|
|
|
}
|
|
|
|
|
for (body = 0, lenb = bodies.length; body < lenb; body += 2)
|
|
|
|
|
emitMsgEnd(bodies[body]);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 'EXISTS':
|
|
|
|
|
// mailbox total message count
|
|
|
|
@ -1198,7 +1201,6 @@ ImapConnection.prototype._storeLabels = function(which, uids, labels, mode, cb)
|
|
|
|
|
if (!Array.isArray(labels))
|
|
|
|
|
labels = [labels];
|
|
|
|
|
labels = labels.join(' ');
|
|
|
|
|
cb = arguments[arguments.length-1];
|
|
|
|
|
|
|
|
|
|
this._send(which + 'STORE ' + uids.join(',') + ' ' + mode
|
|
|
|
|
+ 'X-GM-LABELS.SILENT (' + labels + ')', cb);
|
|
|
|
@ -1362,7 +1364,6 @@ ImapConnection.prototype._store = function(which, uids, flags, isAdding, cb) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
flags = flags.join(' ');
|
|
|
|
|
cb = arguments[arguments.length-1];
|
|
|
|
|
|
|
|
|
|
this._send(which + 'STORE ' + uids.join(',') + ' ' + (isAdding ? '+' : '-')
|
|
|
|
|
+ 'FLAGS.SILENT (' + flags + ')', cb);
|
|
|
|
|