mirror of
https://github.com/moparisthebest/FireTray
synced 2025-01-11 21:48:04 -05:00
fix new message count update when biff becomes false
This commit is contained in:
parent
aa85a3df8b
commit
d1e32bb8d7
src
@ -5,7 +5,7 @@
|
||||
<em:unpack>true</em:unpack> <!-- needed for embedded icons -->
|
||||
<em:type>2</em:type>
|
||||
<em:name>FireTray</em:name>
|
||||
<em:version>0.4.0b3</em:version>
|
||||
<em:version>0.4.0b4</em:version>
|
||||
<em:creator>Hua Luo, Francesco Solero, Foudil BRÉTEL</em:creator>
|
||||
<em:contributor>Hua Luo, Francesco Solero (Firetray original authors)</em:contributor>
|
||||
<em:homepageURL>https://github.com/foudfou/firetray</em:homepageURL>
|
||||
|
@ -32,9 +32,8 @@ firetray.Messaging = {
|
||||
LOG("Enabling Messaging");
|
||||
|
||||
let that = this;
|
||||
let mailSessionNotificationFlags = Ci.nsIFolderListener.intPropertyChanged;
|
||||
MailServices.mailSession.AddFolderListener(that.mailSessionListener,
|
||||
mailSessionNotificationFlags);
|
||||
that.mailSessionListener.notificationFlags);
|
||||
|
||||
this.initialized = true;
|
||||
},
|
||||
@ -50,25 +49,50 @@ firetray.Messaging = {
|
||||
this.initialized = false;
|
||||
},
|
||||
|
||||
/**
|
||||
* http://mxr.mozilla.org/comm-central/source/mailnews/base/public/nsIFolderListener.idl
|
||||
*/
|
||||
mailSessionListener: {
|
||||
/**
|
||||
* @param folder: nsIMsgFolder
|
||||
* @param property: nsIAtom
|
||||
* @param oldFlag: Old header flag (long).
|
||||
* @param newFlag: New header flag (long).
|
||||
*/
|
||||
OnItemIntPropertyChanged: function(folder, property, oldValue, newValue) {
|
||||
notificationFlags:
|
||||
Ci.nsIFolderListener.intPropertyChanged |
|
||||
Ci.nsIFolderListener.boolPropertyChanged, // all
|
||||
|
||||
OnItemPropertyChanged: function(item, property, oldValue, newValue) { // NumNewBiffMessages
|
||||
LOG("OnItemPropertyChanged "+property+" for folder "+item.prettyName+" was "+oldValue+" became "+newValue);
|
||||
},
|
||||
|
||||
OnItemIntPropertyChanged: function(item, property, oldValue, newValue) { // TotalUnreadMessages, BiffState
|
||||
LOG("OnItemIntPropertyChanged "+property+" for folder "+item.prettyName+" was "+oldValue+" became "+newValue);
|
||||
this.updateMsgCount(item, property, oldValue, newValue);
|
||||
},
|
||||
|
||||
OnItemBoolPropertyChanged: function(item, property, oldValue, newValue) { // NewMessages
|
||||
LOG("OnItemBoolPropertyChanged "+property+" for folder "+item.prettyName+" was "+oldValue+" became "+newValue);
|
||||
this.updateMsgCount(item, property, oldValue, newValue);
|
||||
},
|
||||
|
||||
OnItemPropertyFlagChanged: function(item, property, oldFlag, newFlag) {
|
||||
LOG("OnItemPropertyFlagChanged"+property+" for "+item+" was "+oldFlag+" became "+newFlag);
|
||||
},
|
||||
|
||||
OnItemEvent: function(item, event) {
|
||||
LOG("OnItemEvent"+event+" for folder "+item.prettyName);
|
||||
},
|
||||
|
||||
updateMsgCount: function(item, property, oldValue, newValue) {
|
||||
let excludedFoldersFlags = firetray.Utils.prefService.getIntPref("excluded_folders_flags");
|
||||
let msgCountType = firetray.Utils.prefService.getIntPref("message_count_type");
|
||||
LOG("msgCountType="+msgCountType);
|
||||
|
||||
if (!(folder.flags & excludedFoldersFlags)) {
|
||||
if (!(item.flags & excludedFoldersFlags)) {
|
||||
let prop = property.toString();
|
||||
LOG("intProperty "+prop+" for folder "+folder.prettyName+" was "+oldValue+" became "+newValue);
|
||||
if (prop === "TotalUnreadMessages" && msgCountType === FIRETRAY_MESSAGE_COUNT_TYPE_UNREAD ||
|
||||
prop === "BiffState" && msgCountType === FIRETRAY_MESSAGE_COUNT_TYPE_NEW)
|
||||
firetray.Messaging.updateMsgCount();
|
||||
if (msgCountType === FIRETRAY_MESSAGE_COUNT_TYPE_UNREAD &&
|
||||
prop === "TotalUnreadMessages" ||
|
||||
msgCountType === FIRETRAY_MESSAGE_COUNT_TYPE_NEW &&
|
||||
prop === "NewMessages") {
|
||||
firetray.Messaging.updateMsgCount();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user