Changeset 1e5198


Ignore:
Timestamp:
Apr 12, 2008, 7:29:41 AM (14 years ago)
Author:
rene <rene@…>
Branches:
master
Children:
138943
Parents:
31ddc1
Message:

made code resistent against Accounts with missing incomingServer

Location:
chrome/content/v_identity
Files:
3 edited

Legend:

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

    r31ddc1 r1e5198  
    132132        } catch (e) { };
    133133        // check for old (pre 0.5.0) accounts
    134         if (account.incomingServer.hostName == "virtualIdentity") return true;
     134        if (account.incomingServer && account.incomingServer.hostName == "virtualIdentity") return true;
    135135        return false;
    136136    },
    137137   
    138138    __removeAccount : function(account) {
    139         // in new (post 0.5.0) Virtual Identity accounts the Incoming Server of the account
     139        // in new (post 0.5.0) Virtual Identity accounts the incomingServer of the account
    140140        // points to an incoming server of a different account. Cause the internal
    141         // removeAccount function tries to removes the incoming server ether, create
    142         // a real one.
     141        // removeAccount function tries to removes the incomingServer ether, create
     142        // a real one before calling this function.
    143143        if (!account.incomingServer || account.incomingServer.hostName != "virtualIdentity") {
     144            // if not some of the 'old' accounts
    144145            account.incomingServer = vI_account.AccountManager.
    145146                createIncomingServer("toRemove","virtualIdentity","pop3");
     
    186187        vI_account.account.addIdentity(vI_account.AccountManager.createIdentity());
    187188   
    188         // the new account uses the same incomingServer than the base one, has to be replaced before the account is removed
     189        // the new account uses the same incomingServer than the base one,
     190        // it's especially required for NNTP cause incomingServer is used for sending newsposts.
     191        // by pointing to the same incomingServer stored passwords can be reused
     192        // the incomingServer has to be replaced before the account is removed, else it get removed ether
    189193        var servers = vI_account.AccountManager.GetServersForIdentity(vI_helper.getBaseIdentity());
    190194        vI_account.account.incomingServer = servers.QueryElementAt(0, Components.interfaces.nsIMsgIncomingServer);
  • chrome/content/v_identity/vI_smartIdentity.js

    r31ddc1 r1e5198  
    167167            var server = accounts[i].incomingServer;
    168168            // ignore newsgroup accounts if not selected in preferences
    169             if (!vI.preferences.getBoolPref("smart_reply_for_newsgroups") &&
    170                 server.type == "nntp") continue;
    171            
     169            if (server && server.type == "nntp" &&
     170                !vI.preferences.getBoolPref("smart_reply_for_newsgroups")) continue;
    172171           
    173172            var identities = queryISupportsArray(accounts[i].identities, Components.interfaces.nsIMsgIdentity);
  • chrome/content/v_identity/vI_smtpSelector.js

    r31ddc1 r1e5198  
    113113            for (var x in accounts) {
    114114                vI_notificationBar.dump(".")
    115                 var server = accounts[x].incomingServer;
    116115               
    117116                var identities = queryISupportsArray(accounts[x].identities, Components.interfaces.nsIMsgIdentity);
Note: See TracChangeset for help on using the changeset viewer.