[Pkg-mozext-commits] [firetray] 189/399: use built-in unread msg count

David Prévot taffit at alioth.debian.org
Tue Oct 29 18:23:40 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 1b7aef50cebeb449ba79f92b6358f84630b9dd44
Author: foudfou <foudil.newbie+git at gmail.com>
Date:   Sun Mar 4 23:16:57 2012 +0100

    use built-in unread msg count
---
 src/modules/FiretrayMessaging.jsm |   33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/src/modules/FiretrayMessaging.jsm b/src/modules/FiretrayMessaging.jsm
index 0cef528..e41c99a 100644
--- a/src/modules/FiretrayMessaging.jsm
+++ b/src/modules/FiretrayMessaging.jsm
@@ -183,7 +183,7 @@ firetray.Messaging = {
           while(subFolders.hasMoreElements()) {
             let folder = subFolders.getNext().QueryInterface(Ci.nsIMsgFolder);
             if (!(folder.flags & excludedFoldersFlags)) {
-              newMsgCount = this.folderCount(folderCountFunction,folder, newMsgCount);
+              newMsgCount = folderCountFunction(folder, newMsgCount);
             }
           }
         }
@@ -195,30 +195,31 @@ firetray.Messaging = {
     return newMsgCount;
   },
 
-  folderCount: function(folderCountFunction, folder, newMsgCount) {
+  unreadMsgCountIterate: function(folder, accumulator) {
+    let folderCountFunctionName = 'getNumUnread';
+    let folderUnreadMsgCount = folder[folderCountFunctionName](
+      firetray.Utils.prefService.getBoolPref("folder_count_recursive"));
+    LOG(folder.prettyName+" "+folderCountFunctionName+"="+folderUnreadMsgCount);
+    return accumulator + folderUnreadMsgCount;
+  },
+
+  newMsgCountIterate: function(folder, accumulator) {
     if (folder.hasSubFolders && firetray.Utils.prefService.getBoolPref("folder_count_recursive")) {
       LOG("hasSubFolders");
       let subFolders = folder.subFolders;
       while(subFolders.hasMoreElements()) {
         let subFolder = subFolders.getNext().QueryInterface(Ci.nsIMsgFolder);
-        newMsgCount = this.folderCount(folderCountFunction, subFolder, newMsgCount);
+        accumulator = firetray.Messaging.newMsgCountIterate(subFolder, accumulator);
       }
     }
-    newMsgCount = folderCountFunction(folder, newMsgCount);
-    return newMsgCount;
+    accumulator = firetray.Messaging.addHasNewMessages(folder, accumulator);
+    return accumulator;
   },
 
-  unreadMsgCountIterate: function(folder, accumulator) {
-    let folderCountFunctionName = 'getNumUnread';
-    let folderUnreadMsgCount = folder[folderCountFunctionName](false); // do not include subfolders
-    LOG(folder.prettyName+" "+folderCountFunctionName+"="+folderUnreadMsgCount);
-    return accumulator + folderUnreadMsgCount;
-  },
-
-  newMsgCountIterate: function(folder, accumulator) {
-    let folderNewMsgCount = folder.hasNewMessages;
-    LOG(folder.prettyName+" hasNewMessages="+folderNewMsgCount);
-    return accumulator || folderNewMsgCount;
+  addHasNewMessages: function(folder, accumulator) {
+      let folderNewMsgCount = folder.hasNewMessages;
+      LOG(folder.prettyName+" hasNewMessages="+folderNewMsgCount);
+      return accumulator || folderNewMsgCount;
   }
 
 };

-- 
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