[Pkg-mozext-commits] [firetray] 51/399: drop overly complicated exludeCondition for Accounts iterator

David Prévot taffit at alioth.debian.org
Tue Oct 29 18:23:12 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 3d0aaae494ee0088c51fc05e1e82c9c57cf6c636
Author: foudfou <foudil.newbie+git at gmail.com>
Date:   Fri Sep 23 00:47:48 2011 +0200

    drop overly complicated exludeCondition for Accounts iterator
---
 src/chrome/content/options.js |    9 ++++-----
 src/modules/MoztMessaging.jsm |   27 +++++++--------------------
 2 files changed, 11 insertions(+), 25 deletions(-)

diff --git a/src/chrome/content/options.js b/src/chrome/content/options.js
index f5fcb47..6d1c0b4 100644
--- a/src/chrome/content/options.js
+++ b/src/chrome/content/options.js
@@ -30,12 +30,11 @@ mozt.UIOptions = {
     let targetNode = document.getElementById(parentId);
 
     // TODO: sort servers by type, name
-    let exclCond = function(account) {
-      return (mozt.Messaging.SERVER_TYPES_EXCLUDED.indexOf(account.type) >= 0);
-    };
-
-    let accounts = new mozt.Messaging.Accounts(exclCond);
+    let accounts = new mozt.Messaging.Accounts();
     for (let accountServer in accounts) {
+      if (mozt.Messaging.SERVER_TYPES_EXCLUDED.indexOf(accountServer.type) >= 0)
+        continue;
+
       let nodeAccount = document.createElement("checkbox");
       let accountServerKey = accountServer.key.toString();
       nodeAccount.setAttribute('id', accountServerKey);
diff --git a/src/modules/MoztMessaging.jsm b/src/modules/MoztMessaging.jsm
index 7545571..a4b1970 100644
--- a/src/modules/MoztMessaging.jsm
+++ b/src/modules/MoztMessaging.jsm
@@ -93,13 +93,12 @@ mozt.Messaging = {
 
     this._unreadMsgCount = 0;   // reset
     try {
-      let exclCond = function(account) {
-        return ( (mozt.Messaging.SERVER_TYPES_EXCLUDED.indexOf(account.type) >= 0)
-          || (mozt.Messaging.getPrefAccountsExcluded().indexOf(account.key) >= 0) );
-      };
-
-      let accounts = new this.Accounts(exclCond);
+      let accounts = new this.Accounts();
       for (let accountServer in accounts) {
+        if ( (this.SERVER_TYPES_EXCLUDED.indexOf(accountServer.type) >= 0)
+          || (this.getPrefAccountsExcluded().indexOf(accountServer.key) >= 0) )
+          continue;
+
         let rootFolder = accountServer.rootFolder; // nsIMsgFolder
         if (rootFolder.hasSubFolders) {
           let subFolders = rootFolder.subFolders; // nsIMsgFolder
@@ -136,17 +135,8 @@ mozt.Messaging = {
 
   /**
    * Accounts constructor for iterating over account servers
-   * @param exclusionCondition: a function which expresses a condition for excluding accounts
    */
-  Accounts: function(exclusionCondition) {
-    if (typeof(exclusionCondition) == "undefined") {
-      this.exclusionCondition = function(){return false;};
-      return;
-    } else if (typeof(exclusionCondition) != "function") {
-      throw "arg must be a function";
-      return;
-    } else
-      this.exclusionCondition = exclusionCondition;
+  Accounts: function() {
   }
 
 };
@@ -160,9 +150,6 @@ mozt.Messaging.Accounts.prototype.__iterator__ = function() {
     let account = accounts.QueryElementAt(i, Ci.nsIMsgAccount);
     let accountServer = account.incomingServer;
     LOG("ACCOUNT: "+accountServer.prettyName+" type: "+accountServer.type);
-    if ( this.exclusionCondition.call(this, accountServer) )
-      continue;
-
-     yield accountServer;
+    yield accountServer;
   }
 }

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