Changeset d8fb13
- Timestamp:
- Oct 11, 2014, 3:00:35 PM (6 years ago)
- Branches:
- ng_0.9
- Children:
- 25edf9
- Parents:
- 5866ad
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
modules/vI_account.js
r5866ad rd8fb13 214 214 Log.debug("checking for leftover VirtualIdentity accounts ...") 215 215 var accounts = getAccountsArray(); 216 // Log.debug("number of currently used accounts = " + accounts.length); 217 218 for (let acc = 0; acc < accounts.length; acc++) { 219 let checkAccount = accounts[acc]; 220 if (account.__isVIdentityAccount(checkAccount)) { 221 account.__removeAccount(checkAccount); 222 } 223 // replace account with key, required for next check 224 accounts[acc] = accounts[acc].key; 225 // Log.debug("current account = " + accounts[acc]); 226 } 227 228 // var usedAccounts = prefroot.getCharPref("mail.accountmanager.accounts"); 229 var lastAccountKey = prefroot.getIntPref("mail.account.lastKey"); 230 // Log.debug("number of last AccountKey = " + lastAccountKey); 231 for (let key = 0; key <= lastAccountKey; key++) { 232 if (accounts.indexOf("account" + key) > -1) continue; 233 account.__removeAccountPrefs("account" + key); 234 } 235 216 236 for (let acc = 0; acc < accounts.length; acc++) { 217 237 let checkAccount = accounts[acc]; … … 234 254 }, 235 255 236 __removeAccount : function(checkAccount) { 256 __removeAccountPrefs : function(key) { 257 // remove the additional tagging-pref 258 try { 259 prefroot.clearUserPref("mail.account." + key + ".vIdentity"); 260 // prevent useless increasing of lastKey https://bugzilla.mozilla.org/show_bug.cgi?id=485839 261 var lastAccountKey = prefroot.getIntPref("mail.account.lastKey"); 262 if ("account" + lastAccountKey == key) 263 prefroot.setIntPref("mail.account.lastKey", lastAccountKey - 1); 264 } 265 catch (e) { }; 266 try { 267 // account-prefs are not removed, grrrr --> https://bugzilla.mozilla.org/show_bug.cgi?id=875675 268 prefroot.clearUserPref("mail.account." + key + ".server"); 269 } 270 catch (e) { }; 271 try { 272 // account-prefs are not removed, grrrr --> https://bugzilla.mozilla.org/show_bug.cgi?id=875675 273 prefroot.clearUserPref("mail.account." + key + ".identities"); 274 } 275 catch (e) { }; 276 }, 277 278 __removeAccount : function(checkAccount) { 237 279 Log.debug("__removeAccount") 238 280 // in new (post 0.5.0) Virtual Identity accounts the incomingServer of the account … … 254 296 // remove the account 255 297 account._AccountManager.removeAccount(checkAccount); 256 // remove the additional tagging-pref 257 try { prefroot.clearUserPref("mail.account." + key + ".vIdentity"); } 258 catch (e) { }; 298 299 account.__removeAccountPrefs(key); 259 300 }, 260 301 … … 296 337 prefroot.setBoolPref("mail.account." + account._account.key + ".vIdentity", true) 297 338 account._account.addIdentity(account._AccountManager.createIdentity()); 339 340 Log.debug("createAccount create Identity based on baseIdentity (" + baseIdentity.key + ") " + baseIdentity.fullName + " <" + baseIdentity.email + ">"); 298 341 // the new account uses the same incomingServer than the base one, 299 342 // it's especially required for NNTP cause incomingServer is used for sending newsposts.
Note: See TracChangeset
for help on using the changeset viewer.