Changeset ff1a50


Ignore:
Timestamp:
Aug 14, 2008, 4:09:25 PM (11 years ago)
Author:
rene <rene@…>
Branches:
master
Children:
6b7d14
Parents:
25a9a8
Message:

smart_reply_ignoreFullName feature was lost since 0.5.3 (?). Readded feature. Tested for TB3a2.

Location:
chrome/content/v_identity
Files:
3 edited

Legend:

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

    r25a9a8 rff1a50  
    143143        vI_notificationBar.dump("## vI_msgIdentityClone: addIdentityToCloneMenu '" + localIdentityData.id + "'\n");
    144144       
    145         var existingId = localIdentityData.isExistingIdentity();
     145        var existingId = localIdentityData.isExistingIdentity(null);
    146146        vI_notificationBar.dump("## vI_msgIdentityClone: addIdentityToCloneMenu existingId '" + existingId + "'\n");
    147147        if (!existingId) {
     
    459459        vI_msgIdentityClone.localIdentityData.smtp = smtp;
    460460       
    461         var existingIdentity = vI_msgIdentityClone.localIdentityData.isExistingIdentity();
    462         vI_notificationBar.dump("## vI_msgIdentityClone: isExistingIdentity " + existingIdentity + "\n");
    463         return existingIdentity
     461        return vI_msgIdentityClone.localIdentityData.isExistingIdentity(null);
    464462    },
    465463}
  • chrome/content/v_identity/vI_smartIdentity.js

    r25a9a8 rff1a50  
    300300                }
    301301            }   
     302
     303            /* smart_reply_ignoreFullName: compare email with other Identities          */
     304            /* if match replace FullName with existing one, keep identity in list by now        */
     305            /* will not be added to the menu but probably choosen with __smartIdentitySelection     */
     306            if (vI.preferences.getBoolPref("smart_reply_ignoreFullName")) {
     307                vI_notificationBar.dump("## vI_smartIdentity: compare with existing Identities (ignoring FullNames).\n")
     308           
     309                for (index = 0; index < smartIdentities.number; index++) {
     310                    var idKey = smartIdentities.getIdentityData(index).isExistingIdentity(true);
     311                    if (idKey) {
     312                        var newFullName = gAccountManager.getIdentity(idKey).fullName;
     313                        vI_notificationBar.dump("## vI_smartIdentity: replaced Fullname of '" + smartIdentities.emails[index] + "' with '" + newFullName + "' \n");
     314                        smartIdentities.fullNames[index] = newFullName;
     315                        smartIdentities.combinedNames[index] =
     316                            newFullName + " <" + smartIdentities.emails[index] + ">";
     317                    }
     318                }
     319            }
    302320        }
    303321        else vI_notificationBar.dump("## vI_smartIdentity: SmartReply skipped. No Header-information found.\n");
  • chrome/content/v_identity/vI_storage.js

    r25a9a8 rff1a50  
    7474    },
    7575   
    76     isExistingIdentity : function() {
    77         var identity = gAccountManager.defaultAccount.defaultIdentity
    78         if (this.__keyTranslator.getID(this.id))
     76    isExistingIdentity : function(ignoreFullName) {
     77        if (this.__keyTranslator.getID(this.id)) {
     78            vI_notificationBar.dump("## vI_storage: isExistingIdentity compare with Identity " + this.id + "\n");
     79
    7980            identity = gAccountManager.getIdentity(this.id)
    80         equal = (this.__keyTranslator.getSMTP(this.smtp) == this.__keyTranslator.getSMTP(identity.smtpServerKey) &&
    81             identity.getUnicharAttribute("fullName") == this.fullName &&
    82             identity.getUnicharAttribute("useremail") == this.email)
    83        
    84         if (equal) return identity.key
    85         else return null
     81            if (this.__equalsIdentity(identity, ignoreFullName)) {
     82                vI_notificationBar.dump("## vI_storage: existing Identity found: " + this.id + "\n");
     83                return identity.key;
     84            }
     85        }
     86        else {
     87            vI_notificationBar.dump("## vI_storage: isExistingIdentity compare with all Identities\n");
     88            // loop through all identities
     89            var accounts = queryISupportsArray(gAccountManager.accounts, Components.interfaces.nsIMsgAccount);
     90            for (var i in accounts) {
     91                // check for VirtualIdentity Account
     92                try {   vI_account.prefroot.getBoolPref("mail.account." + accounts[i].key + ".vIdentity");
     93                    continue; } catch (e) { };
     94       
     95                var identities = queryISupportsArray(accounts[i].identities, Components.interfaces.nsIMsgIdentity);
     96                for (var j in identities) {
     97                    if (this.__equalsIdentity(identities[j], ignoreFullName)) {
     98                        vI_notificationBar.dump("## vI_storage: existing Identity found: " + identities[j].key + "\n");
     99                        return identities[j].key;
     100                    }
     101                }
     102            }
     103        }
     104        vI_notificationBar.dump("## vI_storage: none existing Identity found.\n");
     105        return null;
    86106    },
    87107
     
    112132    },
    113133
    114     __equals : function(compareIdentityData) {
     134    __equalsIdentity : function(identity, ignoreFullName) {
     135        var testIdentity = new identityData(
     136            identity.email,
     137            identity.fullName,
     138            identity.key,
     139            identity.smtpServerKey, null)
     140        return (this.__equals(testIdentity, ignoreFullName));
     141    },
     142
     143    __equals : function(compareIdentityData, ignoreFullName) {
    115144        this.comp.compareID = compareIdentityData;
    116145
    117         this.comp.equals.fullName = (this.fullName == compareIdentityData.fullName)
     146        this.comp.equals.fullName = (ignoreFullName || this.fullName == compareIdentityData.fullName)
    118147        this.comp.equals.email = (this.email == compareIdentityData.email)
    119148        this.comp.equals.smtpName = this.__equalSMTP(compareIdentityData.smtp);
    120149        this.comp.equals.idName = this.__equalID(compareIdentityData.id);
    121         this.comp.equals.extras = this.extras.equal(compareIdentityData.extras)
     150        this.comp.equals.extras = (!this.extras || this.extras.equal(compareIdentityData.extras))
    122151
    123152        return (this.comp.equals.fullName && this.comp.equals.email && this.comp.equals.smtpName && this.comp.equals.idName && this.comp.equals.extras)
     
    127156        var compareIdentityData = this.__getCurrentIdentityData();
    128157
    129         return this.__equals(compareIdentityData);
     158        return this.__equals(compareIdentityData, null);
    130159    },
    131160
Note: See TracChangeset for help on using the changeset viewer.