Fix confusing unseen mailbox count behavior

fork
Brian White 12 years ago
parent cd54142b15
commit 321387c0e6

@ -201,7 +201,7 @@ node-imap exposes one object: **ImapConnection**.
* **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).
* **unseen** - <_integer_> - Number of messages in this mailbox not having the Seen flag (marked as not having been read).
* **unseen** - <_integer_> - **(Only available with status() calls)** Number of messages in this mailbox not having the Seen flag (marked as not having been read).
* _ImapMessage_ is an object representing an email message. It consists of:
* Properties:
* **seqno** - <_integer_> - This message's sequence number. This number changes when messages with smaller sequence numbers are deleted for example (see the ImapConnection's 'deleted' event). This value is **always** available immediately.

@ -72,7 +72,7 @@ function ImapConnection (options) {
keywords: [],
permFlags: [],
name: null,
messages: { total: 0, new: 0, unseen: 0 }
messages: { total: 0, new: 0 }
},
ext: {
// Capability-specific state info
@ -415,7 +415,7 @@ ImapConnection.prototype.connect = function(loginCb) {
messages: {
total: 0,
new: 0,
unseen: 0
unseen: undefined
}
};
if (m.attributes) {
@ -469,9 +469,7 @@ ImapConnection.prototype.connect = function(loginCb) {
} else if (/^ALERT$/i.test(code))
self.emit('alert', m[3]);
else if (state.status === STATES.BOXSELECTING) {
if (m = /^UNSEEN (\d+)/i.exec(code))
state.box.messages.unseen = parseInt(m[1], 10);
else if (m = /^UIDVALIDITY (\d+)/i.exec(code))
if (m = /^UIDVALIDITY (\d+)/i.exec(code))
state.box.uidvalidity = parseInt(m[1], 10);
else if (m = /^UIDNEXT (\d+)/i.exec(code))
state.box.uidnext = parseInt(m[1], 10);
@ -1254,7 +1252,6 @@ ImapConnection.prototype._resetBox = function() {
this._state.box.name = null;
this._state.box.messages.total = 0;
this._state.box.messages.new = 0;
this._state.box.messages.unseen = 0;
};
ImapConnection.prototype._noop = function() {

Loading…
Cancel
Save