[Pkg-mozext-commits] [firetray] 61/399: fix mail server sorting
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 10e8bb01cffeb37de5c989508909c94566527b3f
Author: foudfou <foudil.newbie+git at gmail.com>
Date: Tue Sep 27 01:46:45 2011 +0200
fix mail server sorting
---
src/modules/FiretrayMessaging.jsm | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/src/modules/FiretrayMessaging.jsm b/src/modules/FiretrayMessaging.jsm
index 204d9dd..5138752 100644
--- a/src/modules/FiretrayMessaging.jsm
+++ b/src/modules/FiretrayMessaging.jsm
@@ -30,7 +30,7 @@ if ("undefined" == typeof(firetray)) {
firetray.Messaging = {
- // TODO: turn into pref
+ // TODO: turn into pref.
SERVER_TYPES: {
"pop3": { order: 1, excluded: false },
"imap": { order: 1, excluded: false },
@@ -133,7 +133,6 @@ firetray.Messaging = {
.replace("#1", this._unreadMsgCount);;
firetray.IconLinux.setTooltip(localizedMessage);
} else {
- ERROR("negative unread messages' count ?"); // should never happen
throw "negative message count"; // should never happen
}
@@ -160,33 +159,36 @@ firetray.Messaging.Accounts.prototype.__iterator__ = function() {
let accounts = MailServices.accounts.accounts;
LOG("sortByTypeAndName="+this.sortByTypeAndName);
- // NOTE: sort() not provided by nsIMsgAccountManager.accounts
- // (nsISupportsArray, nsICollection). Should be OK to re-build a JS-Array for
- // few accounts
+ /* NOTE: sort() not provided by nsIMsgAccountManager.accounts
+ (nsISupportsArray, nsICollection). Should be OK to re-build a JS-Array for
+ few accounts */
let accountServers = [];
for (let i = 0; i < accounts.Count(); i++) {
let account = accounts.QueryElementAt(i, Ci.nsIMsgAccount);
let accountServer = account.incomingServer;
+
+ // checks
+ if (typeof(firetray.Messaging.SERVER_TYPES[accountServer.type]) === "undefined")
+ throw "mail server type for '"+accountServer.prettyName+"' not defined";
+ if (typeof(firetray.Messaging.SERVER_TYPES[accountServer.type].order) === "undefined")
+ throw "mail server type for '"+accountServer.prettyName+"' missing 'order' definition";
+ if (typeof(firetray.Messaging.SERVER_TYPES[accountServer.type].excluded) === "undefined")
+ throw "mail server type for '"+accountServer.prettyName+"' missing 'excluded' definition";
+
accountServers[i] = accountServer;
}
if (this.sortByTypeAndName) {
accountServers.sort(function(a,b) {
- 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[a.type].order
< firetray.Messaging.SERVER_TYPES[b.type].order)
return -1;
if (firetray.Messaging.SERVER_TYPES[a.type].order
> firetray.Messaging.SERVER_TYPES[b.type].order)
return 1;
- if (a.name < b.name)
+ if (a.prettyName < b.prettyName)
return -1;
- if (a.name > b.name)
+ if (a.prettyName > b.prettyName)
return 1;
return 0; // no sorting
});
--
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