[Pkg-mozext-commits] [firetray] 59/399: minor refactoring for mail server types

David Prévot taffit at alioth.debian.org
Tue Oct 29 18:23:14 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 f8a66ac2a5f8e528c6ebd80d7cbbe0b4fb32eeaa
Author: foudfou <foudil.newbie+git at gmail.com>
Date:   Tue Sep 27 01:21:30 2011 +0200

    minor refactoring for mail server types
---
 src/chrome/content/options.js     |    2 +-
 src/modules/FiretrayMessaging.jsm |   28 ++++++++++++++--------------
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/chrome/content/options.js b/src/chrome/content/options.js
index 1a0384a..9d8e947 100644
--- a/src/chrome/content/options.js
+++ b/src/chrome/content/options.js
@@ -37,7 +37,7 @@ firetray.UIOptions = {
 
     let accounts = new firetray.Messaging.Accounts(true);
     for (let accountServer in accounts) {
-      if (firetray.Messaging.SERVER_TYPES_EXCLUDED.indexOf(accountServer.type) >= 0)
+      if (firetray.Messaging.SERVER_TYPES[accountServer.type].excluded)
         continue;
 
       let nodeAccount = document.createElement("checkbox");
diff --git a/src/modules/FiretrayMessaging.jsm b/src/modules/FiretrayMessaging.jsm
index 3bb379e..204d9dd 100644
--- a/src/modules/FiretrayMessaging.jsm
+++ b/src/modules/FiretrayMessaging.jsm
@@ -31,14 +31,13 @@ if ("undefined" == typeof(firetray)) {
 
 firetray.Messaging = {
   // TODO: turn into pref
-  SERVER_TYPES_EXCLUDED: ["nntp","rss","movemail"], // keep "pop3","imap","none"
-  SERVER_TYPES_ORDER: {
-    "pop3":1,
-    "imap":1,
-    "movemail":2,
-    "none":3,
-    "rss":4,
-    "nntp":5
+  SERVER_TYPES: {
+    "pop3": { order: 1, excluded: false },
+    "imap": { order: 1, excluded: false },
+    "movemail": { order: 2, excluded: true },
+    "none": { order: 3, excluded: false },
+    "rss": { order: 4, excluded: true },
+    "nntp": { order: 5, excluded: true }
   },
 
   _unreadMsgCount: 0,
@@ -102,7 +101,7 @@ firetray.Messaging = {
     try {
       let accounts = new this.Accounts();
       for (let accountServer in accounts) {
-        if ( (this.SERVER_TYPES_EXCLUDED.indexOf(accountServer.type) >= 0)
+        if ( (this.SERVER_TYPES[accountServer.type].excluded)
           || (this.getPrefAccountsExcluded().indexOf(accountServer.key) >= 0) )
           continue;
 
@@ -173,16 +172,17 @@ firetray.Messaging.Accounts.prototype.__iterator__ = function() {
 
   if (this.sortByTypeAndName) {
     accountServers.sort(function(a,b) {
-      if (!firetray.Messaging.SERVER_TYPES_ORDER[a.type] || !firetray.Messaging.SERVER_TYPES_ORDER[b.type]) {
+      if (!firetray.Messaging.SERVER_TYPES[a.type]
+          || !firetray.Messaging.SERVER_TYPES[b.type]) {
         ERROR("type '"+a.type+"' not defined in type order");
         return 0;
       }
 
-      if (firetray.Messaging.SERVER_TYPES_ORDER[a.type]
-          < firetray.Messaging.SERVER_TYPES_ORDER[b.type])
+      if (firetray.Messaging.SERVER_TYPES[a.type].order
+          < firetray.Messaging.SERVER_TYPES[b.type].order)
         return -1;
-      if (firetray.Messaging.SERVER_TYPES_ORDER[a.type]
-          > firetray.Messaging.SERVER_TYPES_ORDER[b.type])
+      if (firetray.Messaging.SERVER_TYPES[a.type].order
+          > firetray.Messaging.SERVER_TYPES[b.type].order)
         return 1;
       if (a.name < b.name)
         return -1;

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