Connection: add persistentUIDs property to Box objects

fork
Brian White 11 years ago
parent 8d9f1871be
commit f83449f801

@ -191,6 +191,7 @@ API
* **uidnext** - _integer_ - The uid that will be assigned to the next message that arrives at this mailbox.
* **flags** - _array_ - A list of system-defined flags applicable for this mailbox. Flags in this list but *not* in `permFlags` may be stored for the current session only. Additional server implementation-specific flags may also be available.
* **permFlags** - _array_ - A list of flags that can be permanently added/removed to/from messages in this mailbox.
* **persistentUIDs** - _boolean_ - Whether or not this mailbox has persistent UIDs. This should almost always be true for modern mailboxes and should only be false for legacy mail stores where supporting persistent UIDs was not technically feasible.
* **messages** - _object_ - Contains various message counts for this mailbox:
* **total** - _integer_ - Total number of messages in this mailbox.
* **new** - _integer_ - Number of messages in this mailbox having the Recent flag (this IMAP session is the first to see these messages).

@ -1182,14 +1182,17 @@ Connection.prototype._resUntagged = function(info) {
&& info.textCode.toUpperCase() === 'ALERT')
this.emit('alert', info.text);
else if (this._curReq
&& typeof info.textCode === 'object'
&& info.textCode
&& (RE_OPENBOX.test(this._curReq.type))) {
// we're opening a mailbox
if (!this._box)
this._createCurrentBox();
key = info.textCode.key.toUpperCase();
if (info.textCode.key)
key = info.textCode.key.toUpperCase();
else
key = info.textCode;
if (key === 'UIDVALIDITY')
this._box.uidvalidity = info.textCode.val;
@ -1209,7 +1212,8 @@ Connection.prototype._resUntagged = function(info) {
});
for (i = 0, len = keywords.length; i < len; ++i)
permFlags.splice(permFlags.indexOf(keywords[i]), 1);
}
} else if (key === 'UIDNOTSTICKY')
this._box.persistentUIDs = false;
} else if (typeof info.textCode === 'string'
&& info.textCode.toUpperCase() === 'UIDVALIDITY')
this.emit('uidvalidity', info.text);
@ -1422,6 +1426,7 @@ Connection.prototype._createCurrentBox = function() {
permFlags: [],
keywords: [],
newKeywords: false,
persistentUIDs: true,
messages: {
total: 0,
new: 0

Loading…
Cancel
Save