Changeset eb8a8e


Ignore:
Timestamp:
Dec 9, 2007, 1:29:28 PM (14 years ago)
Author:
rene <rene@…>
Branches:
master
Children:
f94d32
Parents:
f75385
Message:

major change: incoming server is now used from a different account instead of created new. Should now work with nntp-accounts too, cause incoming-server is used for outgoing mails. Might be difficult cause removing the account with account manager might break the prefs. Should be fixed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • chrome/content/v_identity/vI_account.js

    rf75385 reb8a8e  
    2525vI_account = {
    2626    account : null,
    27    
    28     //~ Checks if there is stil another VIdentity Account and creates a new identity number
    29     getNewAccountNumber : function()
    30     {
    31         var accounts = queryISupportsArray(gAccountManager.accounts, Components.interfaces.nsIMsgAccount)
    32         var FreeVIdentityNumber = 0
    33         for (index = 0; index < accounts.length; index++) {
    34             var server = accounts[index].incomingServer;
    35             if (server && server.hostName == "virtualIdentity"
    36             && server.prettyName ==
    37                 document.getElementById("prettyName-Prefix").getAttribute("label")
    38                     + FreeVIdentityNumber)
    39                     FreeVIdentityNumber++
    40         }
    41         return FreeVIdentityNumber;
    42     },
    4327   
    4428    _copyBoolAttribute : function(name) {
     
    9579    removeAccount : function() {
    9680        if (vI_account.account) {
    97             vI_notificationBar.dump("## vI_account: Account " + vI_account.account.incomingServer.prettyName + " removed\n")
    98             try { vI_account.account.incomingServer.rootFolder.Delete(); }
    99             catch (e) { };
     81            vI_account.account.incomingServer = gAccountManager.createIncomingServer("toRemove","virtualIdentity","pop3");
     82            //~ try { vI_account.account.incomingServer.rootFolder.Delete(); }
     83            //~ catch (e) { };
     84           
    10085            gAccountManager.removeAccount(vI_account.account);
    10186            vI_account.account = null;
     
    123108        vI_account.account.addIdentity(gAccountManager.createIdentity());
    124109   
    125         var Number = vI_account.getNewAccountNumber();
    126    
    127         vI_account.account.incomingServer = gAccountManager.createIncomingServer("user"+Number,"virtualIdentity","pop3");
    128         vI_account.account.incomingServer.prettyName = document.getElementById("prettyName-Prefix").getAttribute("label") + Number;
    129 
     110        // the new account uses the same incomingServer than the base one, has to be replaced before the account is removed
     111        var servers = gAccountManager.GetServersForIdentity(vI.helper.getBaseIdentity());
     112        vI_account.account.incomingServer = servers.QueryElementAt(0, Components.interfaces.nsIMsgIncomingServer);
     113       
    130114        vI_account.copyMsgIdentityClone();
    131115        vI_account.copyPreferences();
     
    133117        vI_account.setupDraft();
    134118        vI_account.setupTemplates();
    135        
    136         // remove the folder created with this account - it should never be used to store mails
    137         try { vI_account.account.incomingServer.rootFolder.Delete(); }
    138         catch (e) { };
    139    
    140         vI_notificationBar.dump("## vI_account: New Account created " + vI_account.account.incomingServer.prettyName + "\n");
    141         //~ confirm("## vI_account: New Account created "+server.prettyName+"\n");
    142119    },
    143120   
Note: See TracChangeset for help on using the changeset viewer.