Connection: fix an issue with mailboxes that don’t support modseq (NOMODSEQ)

fork
Chotiwat Chawannakul 11 years ago
parent bf919af813
commit 01c855ea08

@ -593,7 +593,7 @@ Connection.prototype._store = function(which, uids, cfg, cb) {
uids = uids.join(','); uids = uids.join(',');
var modifiers = ''; var modifiers = '';
if (cfg.modseq !== undefined) if (cfg.modseq !== undefined && !this._box.nomodseq)
modifiers += 'UNCHANGEDSINCE ' + cfg.modseq + ' '; modifiers += 'UNCHANGEDSINCE ' + cfg.modseq + ' ';
this._enqueue(which + 'STORE ' + uids + ' ' 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-MSGID');
fetching.push('X-GM-LABELS'); fetching.push('X-GM-LABELS');
} }
if (this.serverSupports('CONDSTORE')) if (this.serverSupports('CONDSTORE') && !this._box.nomodseq)
fetching.push('MODSEQ'); fetching.push('MODSEQ');
fetching.push('UID'); fetching.push('UID');
@ -779,7 +779,8 @@ Connection.prototype._fetch = function(which, uids, options) {
modstr = ' ('; modstr = ' (';
for (i = 0, len = modkeys.length, key; i < len; ++i) { for (i = 0, len = modkeys.length, key; i < len; ++i) {
key = modkeys[i].toUpperCase(); key = modkeys[i].toUpperCase();
if (key === 'CHANGEDSINCE' && this.serverSupports('CONDSTORE')) if (key === 'CHANGEDSINCE' && this.serverSupports('CONDSTORE')
&& !this._box.nomodseq)
modstr += key + ' ' + modifiers[modkeys[i]] + ' '; modstr += key + ' ' + modifiers[modkeys[i]] + ' ';
} }
if (modstr.length > 2) { if (modstr.length > 2) {
@ -1260,6 +1261,8 @@ Connection.prototype._resUntagged = function(info) {
permFlags.splice(permFlags.indexOf(keywords[i]), 1); permFlags.splice(permFlags.indexOf(keywords[i]), 1);
} else if (key === 'UIDNOTSTICKY') } else if (key === 'UIDNOTSTICKY')
this._box.persistentUIDs = false; this._box.persistentUIDs = false;
else if (key === 'NOMODSEQ')
this._box.nomodseq = true;
} else if (typeof info.textCode === 'string' } else if (typeof info.textCode === 'string'
&& info.textCode.toUpperCase() === 'UIDVALIDITY') && info.textCode.toUpperCase() === 'UIDVALIDITY')
this.emit('uidvalidity', info.text); this.emit('uidvalidity', info.text);
@ -1477,6 +1480,7 @@ Connection.prototype._createCurrentBox = function() {
keywords: [], keywords: [],
newKeywords: false, newKeywords: false,
persistentUIDs: true, persistentUIDs: true,
nomodseq: false,
messages: { messages: {
total: 0, total: 0,
new: 0 new: 0

Loading…
Cancel
Save