[Pkg-mozext-commits] [firetray] 177/399: fix new message count update when biff becomes false

David Prévot taffit at alioth.debian.org
Tue Oct 29 18:23:38 UTC 2013


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch dfsg-clean
in repository firetray.

commit d1e32bb8d79d836330b96996cddf4180a7ed7fcc
Author: foudfou <foudil.newbie+git at gmail.com>
Date:   Tue Feb 14 13:30:56 2012 +0100

    fix new message count update when biff becomes false
---
 src/install.rdf                   |    2 +-
 src/modules/FiretrayMessaging.jsm |   54 ++++++++++++++++++++++++++-----------
 2 files changed, 40 insertions(+), 16 deletions(-)

diff --git a/src/install.rdf b/src/install.rdf
index d6a3440..769f163 100644
--- a/src/install.rdf
+++ b/src/install.rdf
@@ -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>
diff --git a/src/modules/FiretrayMessaging.jsm b/src/modules/FiretrayMessaging.jsm
index fadd11b..5fa6ca5 100644
--- a/src/modules/FiretrayMessaging.jsm
+++ b/src/modules/FiretrayMessaging.jsm
@@ -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();
+        }
       }
-
     }
   },
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/firetray.git



More information about the Pkg-mozext-commits mailing list