From 01c855ea08ebae93c48fc075f375b1bd4590c92e Mon Sep 17 00:00:00 2001 From: Chotiwat Chawannakul Date: Tue, 7 Jan 2014 18:46:47 +0700 Subject: [PATCH] =?UTF-8?q?Connection:=20fix=20an=20issue=20with=20mailbox?= =?UTF-8?q?es=20that=20don=E2=80=99t=20support=20modseq=20(NOMODSEQ)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/Connection.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/Connection.js b/lib/Connection.js index 1dae2c7..356e085 100644 --- a/lib/Connection.js +++ b/lib/Connection.js @@ -593,7 +593,7 @@ Connection.prototype._store = function(which, uids, cfg, cb) { uids = uids.join(','); var modifiers = ''; - if (cfg.modseq !== undefined) + if (cfg.modseq !== undefined && !this._box.nomodseq) modifiers += 'UNCHANGEDSINCE ' + cfg.modseq + ' '; this._enqueue(which + 'STORE ' + uids + ' ' @@ -742,7 +742,7 @@ Connection.prototype._fetch = function(which, uids, options) { fetching.push('X-GM-MSGID'); fetching.push('X-GM-LABELS'); } - if (this.serverSupports('CONDSTORE')) + if (this.serverSupports('CONDSTORE') && !this._box.nomodseq) fetching.push('MODSEQ'); fetching.push('UID'); @@ -779,7 +779,8 @@ Connection.prototype._fetch = function(which, uids, options) { modstr = ' ('; for (i = 0, len = modkeys.length, key; i < len; ++i) { key = modkeys[i].toUpperCase(); - if (key === 'CHANGEDSINCE' && this.serverSupports('CONDSTORE')) + if (key === 'CHANGEDSINCE' && this.serverSupports('CONDSTORE') + && !this._box.nomodseq) modstr += key + ' ' + modifiers[modkeys[i]] + ' '; } if (modstr.length > 2) { @@ -1260,6 +1261,8 @@ Connection.prototype._resUntagged = function(info) { permFlags.splice(permFlags.indexOf(keywords[i]), 1); } else if (key === 'UIDNOTSTICKY') this._box.persistentUIDs = false; + else if (key === 'NOMODSEQ') + this._box.nomodseq = true; } else if (typeof info.textCode === 'string' && info.textCode.toUpperCase() === 'UIDVALIDITY') this.emit('uidvalidity', info.text); @@ -1477,6 +1480,7 @@ Connection.prototype._createCurrentBox = function() { keywords: [], newKeywords: false, persistentUIDs: true, + nomodseq: false, messages: { total: 0, new: 0