This is just some static backup of the original site, don't expect every link to work!

Ignore:
Timestamp:
Aug 3, 2014, 12:58:03 PM (8 years ago)
Author:
rene <rene@…>
Branches:
ng_0.9
Children:
ee0ffd
Parents:
eca948
Message:

added option to search matching BaseIdentity? based on domain name

File:
1 edited

Legend:

Unmodified
Added
Removed
  • modules/vI_identityData.js

    reca948 rc55313  
    180180    },
    181181   
    182     equals : function(compareIdentityData) {
     182    // dependent on MsgComposeCommands, should/will only be called in ComposeDialog
     183    hasMatchingDomainIdentity : function() {
     184        Log.debug("hasMatchingDomainIdentity");
     185       
     186        var domainArray = this.email.match(/@[^@]+$/);
     187        if (!domainArray) {
     188            Log.debug("hasMatchingDomainIdentity found no domain for email " + this.email);
     189            return;
     190        }
     191        Log.debug("hasMatchingDomainIdentity searching for domain " + domainArray[0]);
     192       
     193        var accounts = getAccountsArray();
     194        for (let acc = 0; acc < accounts.length; acc++) {
     195            let account = accounts[acc];
     196            try { prefroot.getBoolPref("mail.account."+account.key+".vIdentity"); continue; } catch (e) { };
     197            let identities = getIdentitiesArray(account);
     198            for (let i = 0; i < identities.length; i++) {
     199                let identity = identities[i];
     200                var idDomainArray = identity.email.match(/@[^@]+$/);
     201                if (!idDomainArray) continue;
     202//                 Log.debug("comp: domain.toLowerCase()='" + domainArray[0].toLowerCase() + "' idDomain.toLowerCase()='" + idDomainArray[0].toLowerCase() + "'");
     203                if (domainArray[0].toLowerCase() == idDomainArray[0].toLowerCase()) {
     204                        // if domain matches, everything is perfect!
     205                        Log.debug("hasMatchingDomainIdentity: found matching id for domain '" + domainArray[0] + "'");
     206                        return identity.key; // return key and stop searching
     207                }
     208            }
     209        }
     210        Log.debug("hasMatchingDomainIdentity: '" + domainArray[0] + "' not found");
     211        return null;
     212    },
     213
     214    equals : function(compareIdentityData) {
    183215        this.comp.compareID = compareIdentityData;
    184216
Note: See TracChangeset for help on using the changeset viewer.