1
0
mirror of https://github.com/moparisthebest/FireTray synced 2024-12-23 06:18:48 -05:00

fix cleanExcludedAccounts()

This commit is contained in:
foudfou 2012-04-21 16:15:43 +02:00
parent b8346e36c3
commit 8d0917ab62

View File

@ -61,7 +61,6 @@ firetray.Messaging = {
/* removes removed accounts from excludedAccounts pref. NOTE: Can't be called /* removes removed accounts from excludedAccounts pref. NOTE: Can't be called
at shutdown because MailServices.accounts no longer available */ at shutdown because MailServices.accounts no longer available */
cleanExcludedAccounts: function() { cleanExcludedAccounts: function() {
try {
F.LOG("* cleaning *"); F.LOG("* cleaning *");
let mailAccounts = firetray.Utils.getObjPref('mail_accounts'); let mailAccounts = firetray.Utils.getObjPref('mail_accounts');
let excludedAccounts = mailAccounts["excludedAccounts"]; let excludedAccounts = mailAccounts["excludedAccounts"];
@ -71,12 +70,12 @@ firetray.Messaging = {
let accountServerKeys = []; let accountServerKeys = [];
for (let i=0, len=accounts.Count(); i<len; ++i) { for (let i=0, len=accounts.Count(); i<len; ++i) {
let account = accounts.QueryElementAt(i, Ci.nsIMsgAccount); let account = accounts.QueryElementAt(i, Ci.nsIMsgAccount);
let accountServer = account.incomingServer; accountServerKeys[i] = account.incomingServer.key;
accountServerKeys[i] = accountServer;
} }
let newExcludedAccounts = [], cleaningNeeded = 0; let newExcludedAccounts = [], cleaningNeeded = 0;
for (let excludedAccount in excludedAccounts) { for (let i=0, len=excludedAccounts.length; i<len; ++i) {
let excludedAccount = excludedAccounts[i];
if (accountServerKeys.indexOf(excludedAccount) >= 0) if (accountServerKeys.indexOf(excludedAccount) >= 0)
newExcludedAccounts.push(excludedAccount); newExcludedAccounts.push(excludedAccount);
else else
@ -88,7 +87,6 @@ firetray.Messaging = {
let prefObj = {"serverTypes":mailAccounts["serverTypes"], "excludedAccounts":newExcludedAccounts}; let prefObj = {"serverTypes":mailAccounts["serverTypes"], "excludedAccounts":newExcludedAccounts};
firetray.Utils.setObjPref('mail_accounts', prefObj); firetray.Utils.setObjPref('mail_accounts', prefObj);
} }
} catch(x) { F.ERROR(x); }
}, },
/* http://mxr.mozilla.org/comm-central/source/mailnews/base/public/nsIFolderListener.idl */ /* http://mxr.mozilla.org/comm-central/source/mailnews/base/public/nsIFolderListener.idl */