Initialize and reset unseen property. Fix wrong property assignment.

fork
Chotiwat Chawannakul 12 years ago
parent e8e2130249
commit 009ccc6beb

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

Loading…
Cancel
Save