[Pkg-mozext-commits] [firetray] 58/399: add order to mail server types

David Prévot taffit at alioth.debian.org
Tue Oct 29 18:23:13 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 4acc9bcefc07dba2075b80f6167710b8bf490457
Author: foudfou <foudil.newbie+git at gmail.com>
Date:   Tue Sep 27 00:55:13 2011 +0200

    add order to mail server types
---
 src/modules/FiretrayMessaging.jsm |   19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/src/modules/FiretrayMessaging.jsm b/src/modules/FiretrayMessaging.jsm
index 00b8a24..3bb379e 100644
--- a/src/modules/FiretrayMessaging.jsm
+++ b/src/modules/FiretrayMessaging.jsm
@@ -32,6 +32,14 @@ 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
+  },
 
   _unreadMsgCount: 0,
 
@@ -165,9 +173,16 @@ firetray.Messaging.Accounts.prototype.__iterator__ = function() {
 
   if (this.sortByTypeAndName) {
     accountServers.sort(function(a,b) {
-      if (a.type < b.type)
+      if (!firetray.Messaging.SERVER_TYPES_ORDER[a.type] || !firetray.Messaging.SERVER_TYPES_ORDER[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])
         return -1;
-      if (a.type > b.type)
+      if (firetray.Messaging.SERVER_TYPES_ORDER[a.type]
+          > firetray.Messaging.SERVER_TYPES_ORDER[b.type])
         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