Changeset c0a8de


Ignore:
Timestamp:
Nov 15, 2011, 1:12:18 AM (8 years ago)
Author:
rene <rene@…>
Branches:
ng_0.9
Children:
4a8e42
Parents:
021dbf
Message:

implemented new logging, nearly done

Files:
17 edited

Legend:

Unmodified
Added
Removed
  • content/_overlayNameSpaceWrapper.js

    r021dbf rc0a8de  
    11// copied and adapted from http://www.softwareishard.com/blog/planet-mozilla/firefox-extensions-global-namespace-pollution/
    22// The only global object for this extension.
     3
     4Components.utils.import("resource://v_identity/vI_log.js");
     5let Log = setupLogging("virtualIdentity.overlayNameSpaceWrapper");
    36
    47// prevent double initializations by different overlays
     
    69    var virtualIdentityExtension = {};
    710    virtualIdentityExtension.initTime = parseInt((new Date()).getTime());
    8     dump("init vI_overlayNameSpaceWrapper " + virtualIdentityExtension.initTime + "\n");
     11    Log.debug("init vI_overlayNameSpaceWrapper " + virtualIdentityExtension.initTime + "\n");
    912
    1013    (function() { this.ns = function(fn) { fn.apply({}); };  }).apply(virtualIdentityExtension);
     
    1215    virtualIdentityExtension.LIB = {
    1316        // Shared APIs
    14         getCurrentURI: function() { dump("getCurrentURI " + window.location.href + "\n"); return window.location.href; },
     17        getCurrentURI: function() {
     18          Log.debug("getCurrentURI " + window.location.href + "\n");
     19          return window.location.href;
     20        },
    1521
    1622        // Extension singleton shortcut
  • content/_version.dtd

    r021dbf rc0a8de  
    11<!-- the version-string is still required, because the only other way to retrieve the Version-Number is asynchronous -->
    2 <!ENTITY vident.version "0.9pre1">
     2<!ENTITY vident.version "0.9pre2">
  • content/modules/plugins/conversation.js

    r021dbf rc0a8de  
    11virtualIdentityExtension.ns(function() { with (virtualIdentityExtension.LIB) {
    22
    3 const Ci = Components.interfaces;
    4 const Cc = Components.classes;
    5 const Cu = Components.utils;
     3Components.utils.import("resource://v_identity/vI_log.js");
     4let Log = setupLogging("virtualIdentity.plugin.conversation");
     5
     6const {classes: Cc, interfaces: Ci, utils: Cu, results : Cr} = Components;
    67
    78let pref = Cc["@mozilla.org/preferences-service;1"]
     
    1920let virtualIdInUse;
    2021let virtualSenderNameElem;
    21 let Log;
     22
     23
    2224let _rdfDatasourceAccess;
    2325
     
    4446
    4547let conversationHook = {
    46   onComposeSessionChanged: function (aComposeSession, aAddress, ExternalLog) {
    47     Log = ExternalLog;
     48  onComposeSessionChanged: function (aComposeSession, aAddress) {
    4849    let toAddrList = aAddress.to.concat(aAddress.cc);
    4950   
     
    9091  },
    9192 
    92   onMessageBeforeSendOrPopout: function(aAddress, aStatus, aPopout, ExternalLog) {
    93     Log = ExternalLog;
     93  onMessageBeforeSendOrPopout: function(aAddress, aStatus, aPopout) {
    9494    let toAddrList = aAddress.to.concat(aAddress.cc);
    9595    Log.debug("## onMessageBeforeSendOrPopup");
     
    135135  },
    136136
    137   onRecipientAdded: function onRecipientAdded(aData, aType, aCount, ExternalLog) {
    138     Log = ExternalLog;
    139    
     137  onRecipientAdded: function onRecipientAdded(aData, aType, aCount) {
    140138    Log.debug("onRecipientAdded", aData.data, aType, aCount);
    141139    if (!pref.getBoolPref("storage")) return;
  • content/modules/vI_account.js

    r021dbf rc0a8de  
    2626
    2727virtualIdentityExtension.ns(function() { with (virtualIdentityExtension.LIB) {
     28
     29Components.utils.import("resource://v_identity/vI_log.js");
     30let Log = setupLogging("virtualIdentity.account");
     31
    2832function prepareSendMsg(vid, msgType, identityData, baseIdentity, recipients) {
    2933    var stringBundle = Services.strings.createBundle("chrome://v_identity/locale/v_identity.properties");
     
    3943            .getService(Components.interfaces.nsIMsgAccountManager);
    4044           
    41     MyLog.debug("\n## prepareSendMsg " + msgType + " " + Components.interfaces.nsIMsgCompDeliverMode.Now + "\n");
     45    Log.debug("\n## prepareSendMsg " + msgType + " " + Components.interfaces.nsIMsgCompDeliverMode.Now + "\n");
    4246   
    4347    returnValue = {};
     
    5761            var returnValue = localeDatasourceAccess.storeVIdentityToAllRecipients(identityData, recipients)
    5862            if ( returnValue.update == "abort" || returnValue.update == "takeover" ) {
    59                 MyLog.debug("## prepareSendMsg: sending aborted\n");
     63                Log.debug("## prepareSendMsg: sending aborted\n");
    6064                return returnValue;
    6165            }
    6266        }
    63         else MyLog.debug("## prepareSendMsg: storage deactivated\n");
     67        else Log.debug("## prepareSendMsg: storage deactivated\n");
    6468    }
    6569    if (vid) {
     
    7680    var currentIdentityData = new vI.identityData(currentIdentity.email, currentIdentity.fullName, null, currentIdentity.smtpServerKey, null, null, null);
    7781   
    78     MyLog.debug("\n## vI.identityData SendMessage Final Check\n");
    79     MyLog.debug("## vI.identityData currentIdentity: fullName='" + currentIdentityData.fullName + "' email='" + currentIdentityData.email + "' smtp='" + currentIdentityData.smtp.key + "'\n");
    80     MyLog.debug("## vI.identityData virtualIdentityData: fullName='" + virtualIdentityData.fullName + "' email='" + virtualIdentityData.email + "' smtp='" + virtualIdentityData.smtp.key + "'\n");
     82    Log.debug("\n## vI.identityData SendMessage Final Check\n");
     83    Log.debug("## vI.identityData currentIdentity: fullName='" + currentIdentityData.fullName + "' email='" + currentIdentityData.email + "' smtp='" + currentIdentityData.smtp.key + "'\n");
     84    Log.debug("## vI.identityData virtualIdentityData: fullName='" + virtualIdentityData.fullName + "' email='" + virtualIdentityData.email + "' smtp='" + virtualIdentityData.smtp.key + "'\n");
    8185
    8286    if  (currentIdentityData.fullName.toLowerCase() == virtualIdentityData.fullName.toLowerCase()   &&
     
    8690    }
    8791    else {
    88         if (!(currentIdentityData.fullName.toLowerCase() == virtualIdentityData.fullName.toLowerCase())) MyLog.debug("\n## vI.identityData failed check for fullName.\n");
    89         if (!(currentIdentityData.email.toLowerCase() == virtualIdentityData.email.toLowerCase())) MyLog.debug("\n## vI.identityData failed check for email.\n");
    90         if (!(virtualIdentityData.smtp.equal(currentIdentityData.smtp))) MyLog.debug("\n## vI.identityData failed check for SMTP.\n");
     92        if (!(currentIdentityData.fullName.toLowerCase() == virtualIdentityData.fullName.toLowerCase())) Log.debug("\n## vI.identityData failed check for fullName.\n");
     93        if (!(currentIdentityData.email.toLowerCase() == virtualIdentityData.email.toLowerCase())) Log.debug("\n## vI.identityData failed check for email.\n");
     94        if (!(virtualIdentityData.smtp.equal(currentIdentityData.smtp))) Log.debug("\n## vI.identityData failed check for SMTP.\n");
    9195        alert(stringBundle.getStringFromName("vident.genericSendMessage.error"));
    9296        return false
     
    136140        if (account._pref.getBoolPref("copySMIMESettings")) {
    137141            // SMIME settings
    138             MyLog.debug("## account: copy S/MIME settings\n")
     142            Log.debug("## account: copy S/MIME settings\n")
    139143            account._copyUnicharAttribute("signing_cert_name");
    140144            account._copyUnicharAttribute("encryption_cert_name");
     
    144148        if (account._pref.getBoolPref("copyEnigmailSettings")) {
    145149            // pgp/enigmail settings
    146             MyLog.debug("## account: copy PGP settings\n")
     150            Log.debug("## account: copy PGP settings\n")
    147151            account._copyBoolAttribute("pgpSignEncrypted");
    148152            account._copyBoolAttribute("pgpSignPlain");
     
    157161        if (account._pref.getBoolPref("copyAttachVCardSettings")) {
    158162            // attach vcard
    159             MyLog.debug("## account: copy VCard settings\n")
     163            Log.debug("## account: copy VCard settings\n")
    160164            account._copyBoolAttribute("attachVCard");
    161165            account._copyCharAttribute("escapedVCard");
     
    181185
    182186    __cleanupDirectories : function() {
    183         MyLog.debug("## account: checking for leftover VirtualIdentity directories ")
     187        Log.debug("## account: checking for leftover VirtualIdentity directories ")
    184188
    185189        var file = Components.classes["@mozilla.org/file/directory_service;1"]
     
    201205                        if (account.__dirEmpty(maildir)) {
    202206                            try {maildir.remove(true)} catch(e) { }
    203                             MyLog.debug("x");
     207                            Log.debug("x");
    204208                        }
    205                         else MyLog.debug(".");
     209                        else Log.debug(".");
    206210                       
    207211                    }
     
    209213            }
    210214        }
    211         MyLog.debug(" - done\n")
     215        Log.debug(" - done\n")
    212216    },
    213217   
    214218    cleanupSystem : function() {
    215         MyLog.debug("## account: checking for leftover VirtualIdentity accounts ")
     219        Log.debug("## account: checking for leftover VirtualIdentity accounts ")
    216220        for (var i=0; i < account._AccountManager.accounts.Count(); i++) {
    217221            var checkAccount = account._AccountManager.accounts.QueryElementAt(i, Components.interfaces.nsIMsgAccount);
    218222            if (account.__isVIdentityAccount(checkAccount)) {
    219                 MyLog.debug(".")
     223                Log.debug(".")
    220224                account.__removeAccount(checkAccount);
    221225            }
    222226        }
    223         MyLog.debug(" - done\n")
     227        Log.debug(" - done\n")
    224228        account.__cleanupDirectories();
    225229    },
     
    236240   
    237241    __removeAccount : function(checkAccount) {
    238         MyLog.debug("## account: __removeAccount\n")
     242        Log.debug("## account: __removeAccount\n")
    239243        // in new (post 0.5.0) Virtual Identity accounts the incomingServer of the account
    240244        // points to an incoming server of a different account. Cause the internal
     
    252256       
    253257        var key = checkAccount.key;
    254         MyLog.debug("## account: removing account " + key + ".\n")
     258        Log.debug("## account: removing account " + key + ".\n")
    255259        // remove the account
    256260        account._AccountManager.removeAccount(checkAccount);
     
    325329            account._account.defaultIdentity.smtpServerKey = baseIdentity.smtpServerKey;
    326330
    327         MyLog.debug("## account: Stored virtualIdentity (name "
     331        Log.debug("## account: Stored virtualIdentity (name "
    328332            + account._account.defaultIdentity.fullName + " email "
    329333            + account._account.defaultIdentity.email + " smtp "
     
    341345            {
    342346                case "2"  :
    343                 MyLog.debug ("## account: preparing Fcc --- use Settings of Default Account\n");
     347                Log.debug ("## account: preparing Fcc --- use Settings of Default Account\n");
    344348                account._account.defaultIdentity.doFcc = account._AccountManager.defaultAccount.defaultIdentity.doFcc;
    345349                account._account.defaultIdentity.fccFolder = account._AccountManager.defaultAccount.defaultIdentity.fccFolder;
     
    348352                break;
    349353                case "3"  :
    350                 MyLog.debug ("## account: preparing Fcc --- use Settings of Modified Account\n");
     354                Log.debug ("## account: preparing Fcc --- use Settings of Modified Account\n");
    351355                account._account.defaultIdentity.doFcc = account._baseIdentity.doFcc;
    352356                account._account.defaultIdentity.fccFolder = account._baseIdentity.fccFolder;
     
    355359                break;
    356360                default  :
    357                 MyLog.debug ("## account: preparing Fcc --- use Virtual Identity Settings\n");
     361                Log.debug ("## account: preparing Fcc --- use Virtual Identity Settings\n");
    358362                account._account.defaultIdentity.doFcc
    359363                    = account._pref.getBoolPref("doFcc");
     
    371375            account._account.defaultIdentity.doFcc = false;
    372376        }
    373         MyLog.debug("## account: Stored (doFcc " + account._account.defaultIdentity.doFcc + " fccFolder " +
     377        Log.debug("## account: Stored (doFcc " + account._account.defaultIdentity.doFcc + " fccFolder " +
    374378            account._account.defaultIdentity.fccFolder + " fccFolderPickerMode " +
    375379            account._account.defaultIdentity.fccFolderPickerMode + "(" +
     
    381385        {
    382386            case "2"  :
    383             MyLog.debug ("## account: preparing Draft --- use Settings of Default Account\n");
     387            Log.debug ("## account: preparing Draft --- use Settings of Default Account\n");
    384388            account._account.defaultIdentity.draftFolder = account._AccountManager.defaultAccount.defaultIdentity.draftFolder;
    385389            account._account.defaultIdentity.draftsFolderPickerMode = account._AccountManager.defaultAccount.defaultIdentity.draftsFolderPickerMode;
    386390            break;
    387391            case "3"  :
    388             MyLog.debug ("## account: preparing Draft --- use Settings of Modified Account\n");
     392            Log.debug ("## account: preparing Draft --- use Settings of Modified Account\n");
    389393            account._account.defaultIdentity.draftFolder = account._baseIdentity.draftFolder;
    390394            account._account.defaultIdentity.draftsFolderPickerMode = account._baseIdentity.draftsFolderPickerMode;
    391395            break;
    392396            default  :
    393             MyLog.debug ("## account: preparing Draft --- use Virtual Identity Settings\n");
     397            Log.debug ("## account: preparing Draft --- use Virtual Identity Settings\n");
    394398            account._account.defaultIdentity.draftFolder
    395399                = account._unicodeConverter.ConvertToUnicode(account._pref.getCharPref("draftFolder"));
     
    398402            break;
    399403        }
    400         MyLog.debug("## account: Stored (draftFolder " +
     404        Log.debug("## account: Stored (draftFolder " +
    401405            account._account.defaultIdentity.draftFolder + " draftsFolderPickerMode " +
    402406            account._account.defaultIdentity.draftsFolderPickerMode + "(" +
     
    408412        {
    409413            case "2"  :
    410             MyLog.debug ("## account: preparing Templates --- use Settings of Default Account\n");
     414            Log.debug ("## account: preparing Templates --- use Settings of Default Account\n");
    411415            account._account.defaultIdentity.stationeryFolder = account._AccountManager.defaultAccount.defaultIdentity.stationeryFolder;
    412416            account._account.defaultIdentity.tmplFolderPickerMode = account._AccountManager.defaultAccount.defaultIdentity.tmplFolderPickerMode;
    413417            break;
    414418            case "3"  :
    415             MyLog.debug ("## account: preparing Templates --- use Settings of Modified Account\n");
     419            Log.debug ("## account: preparing Templates --- use Settings of Modified Account\n");
    416420            account._account.defaultIdentity.stationeryFolder = account._baseIdentity.stationeryFolder;
    417421            account._account.defaultIdentity.tmplFolderPickerMode = account._baseIdentity.tmplFolderPickerMode;
    418422            break;
    419423            default  :
    420             MyLog.debug ("## account: preparing Templates --- use Virtual Identity Settings\n");
     424            Log.debug ("## account: preparing Templates --- use Virtual Identity Settings\n");
    421425            account._account.defaultIdentity.stationeryFolder
    422426                = account._unicodeConverter.ConvertToUnicode(account._pref.getCharPref("stationeryFolder"));
     
    425429            break;
    426430        }
    427         MyLog.debug("## account: Stored (stationeryFolder " +
     431        Log.debug("## account: Stored (stationeryFolder " +
    428432            account._account.defaultIdentity.stationeryFolder + " tmplFolderPickerMode " +
    429433            account._account.defaultIdentity.tmplFolderPickerMode + "(" +
  • content/modules/vI_identityData.js

    r021dbf rc0a8de  
    2424
    2525virtualIdentityExtension.ns(function() { with (virtualIdentityExtension.LIB) {
     26 
     27Components.utils.import("resource://v_identity/vI_log.js");
     28let Log = setupLogging("virtualIdentity.identityData");
     29
    2630function identityData(email, fullName, id, smtp, extras, sideDescription, existingID) {
    2731    this._email = email?email:"";
     
    7074            this._fullName += RegExp.leftContext + RegExp.rightContext;
    7175            this._email = RegExp.lastMatch;
    72 //          MyLog.debug("## identityData: parseEmail _fullName = '" + this._fullName + "'\n");
    73 //          MyLog.debug("## identityData: parseEmail _email =    '" + this._email + "'\n");
     76//          Log.debug("## identityData: parseEmail _fullName = '" + this._fullName + "'\n");
     77//          Log.debug("## identityData: parseEmail _email =    '" + this._email + "'\n");
    7478        }
    7579        this._emailParsed = true;
     
    8286
    8387    cleanName : function(fullName) {
    84 //      MyLog.debug("## identityData: cleanName init '" + fullName + "'\n");
     88//      Log.debug("## identityData: cleanName init '" + fullName + "'\n");
    8589        var _fullName = fullName.replace(/^\s+|\s+$/g,"");
    8690        if (_fullName.search(/^\".+\"$|^'.+'$/g) != -1) {
    8791            _fullName = this.cleanName(_fullName.replace(/^\"(.+)\"$|^'(.+)'$/g,"$1$2"));
    8892        }
    89 //      MyLog.debug("## identityData: cleanName done '" + _fullName + "'\n");
     93//      Log.debug("## identityData: cleanName done '" + _fullName + "'\n");
    9094        return _fullName;
    9195    },
     
    132136    // dependent on MsgComposeCommands, should/will only be called in ComposeDialog
    133137    isExistingIdentity : function(ignoreFullNameWhileComparing) {
    134         MyLog.debug("## identityData: isExistingIdentity: ignoreFullNameWhileComparing='" + ignoreFullNameWhileComparing + "'\n");
    135 //      MyLog.debug("## identityData base: fullName.toLowerCase()='" + this.fullName + "' email.toLowerCase()='" + this.email + "' smtp='" + this.smtp.key + "'\n");
     138        Log.debug("## identityData: isExistingIdentity: ignoreFullNameWhileComparing='" + ignoreFullNameWhileComparing + "'\n");
     139//      Log.debug("## identityData base: fullName.toLowerCase()='" + this.fullName + "' email.toLowerCase()='" + this.email + "' smtp='" + this.smtp.key + "'\n");
    136140
    137141        var ignoreFullNameMatchKey = null;
     
    143147            for (let j = 0; j < account.identities.Count(); j++) {
    144148                var identity = account.identities.QueryElementAt(j, Components.interfaces.nsIMsgIdentity);
    145 //              MyLog.debug("## identityData comp: fullName.toLowerCase()='" + identity.fullName.toLowerCase() + "' email.toLowerCase()='" + identity.email.toLowerCase() + "' smtp='" + identity.smtpServerKey + "'\n");
     149//              Log.debug("## identityData comp: fullName.toLowerCase()='" + identity.fullName.toLowerCase() + "' email.toLowerCase()='" + identity.email.toLowerCase() + "' smtp='" + identity.smtpServerKey + "'\n");
    146150                var email = this.email?this.email:"";               // might be null if no identity is set
    147151                var idEmail = identity.email?identity.email:""; // might be null if no identity is set
     
    150154                        // if fullName matches, than this is a final match
    151155                        if ( this.fullName.toLowerCase() == identity.fullName.toLowerCase() ) {
    152                             MyLog.debug("## identityData: isExistingIdentity: " + this.combinedName + " found, id='" + identity.key + "'\n");
     156                            Log.debug("## identityData: isExistingIdentity: " + this.combinedName + " found, id='" + identity.key + "'\n");
    153157                            return identity.key; // return key and stop searching
    154158                        }
     
    160164
    161165        if ( ignoreFullNameWhileComparing && ignoreFullNameMatchKey ) {
    162             MyLog.debug("## identityData: isExistingIdentity: " + this.combinedName + " found, id='" + ignoreFullNameMatchKey + "'\n");
     166            Log.debug("## identityData: isExistingIdentity: " + this.combinedName + " found, id='" + ignoreFullNameMatchKey + "'\n");
    163167            return  ignoreFullNameMatchKey;
    164168        }
    165169
    166         MyLog.debug("## identityData: isExistingIdentity: " + this.combinedName + " not found\n");
     170        Log.debug("## identityData: isExistingIdentity: " + this.combinedName + " not found\n");
    167171        return null;
    168172    },
     
    239243
    240244    dropIdentity : function(index) {
    241         MyLog.debug("## identityCollection:   dropping address from inputList: " + this.identityDataCollection[index].combinedName + "\n");
     245        Log.debug("## identityCollection:   dropping address from inputList: " + this.identityDataCollection[index].combinedName + "\n");
    242246        while (index < (this.number - 1)) { this.identityDataCollection[index] = this.identityDataCollection[++index]; };
    243247        this.identityDataCollection[--this.number] = null;
     
    254258                if (this.identityDataCollection[index].fullName == "" && identityData.fullName != "") {
    255259                    this.identityDataCollection[index].fullName = identityData.fullName;
    256                     MyLog.debug("## identityCollection:   added fullName '" + identityData.fullName
     260                    Log.debug("## identityCollection:   added fullName '" + identityData.fullName
    257261                        + "' to stored email '" + this.identityDataCollection[index].email +"'\n")
    258262                }
     
    263267                    this.identityDataCollection[index].smtp.key = identityData.smtp.key;
    264268                    this.identityDataCollection[index].extras = identityData.extras;
    265                     MyLog.debug("## identityCollection:   added id '" + identityData.id.value
     269                    Log.debug("## identityCollection:   added id '" + identityData.id.value
    266270                        + "' smtp '" + identityData.smtp.value + "' (+extras) to stored email '" + this.identityDataCollection[index].email +"'\n")
    267271                }
     
    269273            }
    270274        }
    271         MyLog.debug("## identityCollection:   add new address to result: " + identityData.combinedName + "\n")
     275        Log.debug("## identityCollection:   add new address to result: " + identityData.combinedName + "\n")
    272276        this.identityDataCollection[index] = identityData;
    273277        this.number = index + 1;
  • content/modules/vI_rdfDatasource.js

    r021dbf rc0a8de  
    888888                isNotFirstInputElement &&                           // and it is now not the first recipient entered
    889889                !localIdentities.identityDataCollection[0].equalsIdentity(currentIdentity, false).equal) {      // and this id is different than the current used one
    890                     setNote(
    891                         this.stringBundle.GetStringFromName("vident.smartIdentity.vIStorageCollidingIdentity"), // than drop the potential changes
    892                         "storage_notification");
     890                    StorageNotification.info(this.stringBundle.GetStringFromName("vident.smartIdentity.vIStorageCollidingIdentity"));
    893891//                  returnValue.result = "drop";    // this is the default value
    894892            }
  • content/modules/vI_smartIdentityCollection.js

    r021dbf rc0a8de  
    2828
    2929Components.utils.import("resource://v_identity/vI_log.js");
     30let Log = setupLogging("virtualIdentity.smartIdentityCollection");
    3031
    3132function smartIdentityCollection(msgHdr, preseletedID, currentIDisVID, newsgroup, recipients) {
     
    6465    // this function adds a timestamp to the current sender
    6566    __autoTimestamp : function() {
    66         MyLog.debug("## smartIdentity: __autoTimestamp()\n");
     67        Log.debug("## smartIdentity: __autoTimestamp()\n");
    6768        if (this._IDisVID) {
    68             MyLog.debug("## smartIdentity: Virtual Identity in use, aborting\n");
     69            Log.debug("## smartIdentity: Virtual Identity in use, aborting\n");
    6970            return;
    7071        }
     
    7475        var domain = current_email[1];
    7576       
    76         MyLog.debug("## smartIdentity: current email: " + current_email[0] + "@" + current_email[1] + "\n");
     77        Log.debug("## smartIdentity: current email: " + current_email[0] + "@" + current_email[1] + "\n");
    7778       
    7879        var autoString = this._pref.getCharPref("autoString");
     
    8687       
    8788        var new_email = autoString.replace(/%l/g, localpart).replace(/%d/g, domain).replace(/%t/g,dateString);
    88         MyLog.debug("## smartIdentity: new email: " + new_email + "\n");
     89        Log.debug("## smartIdentity: new email: " + new_email + "\n");
    8990
    9091        var newIdentity = new vI.identityData(new_email,
     
    9697   
    9798    __ignoreID : function() {
    98         MyLog.debug("## smartIdentity: checking " + this._pref.getCharPref("idSelection_ignoreIDs") + " against " + this._preselectedID.key + "\n")
     99        Log.debug("## smartIdentity: checking " + this._pref.getCharPref("idSelection_ignoreIDs") + " against " + this._preselectedID.key + "\n")
    99100        // check if usage if virtual Identities should be used at all for the currently selected ID
    100101        if (this._pref.getCharPref("idSelection_ignoreIDs").indexOf(":" + this._preselectedID.key + ":") != -1) {
    101             MyLog.debug("## smartIdentity: not using virtual Identites for ID " + this._preselectedID.key + "\n");
     102            Log.debug("## smartIdentity: not using virtual Identites for ID " + this._preselectedID.key + "\n");
    102103            return true;
    103104        }
     
    106107   
    107108    NewMail : function() {
    108         MyLog.debug("## smartIdentity: NewMail()\n");
     109        Log.debug("## smartIdentity: NewMail()\n");
    109110        if (this.__ignoreID()) return;
    110111        this._rdfDatasourceAccess.getVIdentityFromAllRecipients(this._allIdentities, this._recipients);
     
    120121                // reorder list of Identities to prefer it on autoselect
    121122                // has to be done before Identities are added to the Menu
    122                 MyLog.debug("## smartIdentity: found existing Identity, reorder to prefer this one.\n");
     123                Log.debug("## smartIdentity: found existing Identity, reorder to prefer this one.\n");
    123124                var firstIdentity = this._allIdentities.identityDataCollection[index];
    124125                for (var i = index; index > 0; index--) {
     
    133134   
    134135    ReplyOnSent : function() {
    135         MyLog.debug("## smartIdentity: ReplyOnSent() (rules like SmartDraft)\n");
     136        Log.debug("## smartIdentity: ReplyOnSent() (rules like SmartDraft)\n");
    136137        this.__SmartDraftOrReplyOnSent();
    137138        this._rdfDatasourceAccess.getVIdentityFromAllRecipients(this._allIdentities, this._recipients);
     
    139140
    140141    Draft : function() {
    141         MyLog.debug("## smartIdentity: Draft()\n");
     142        Log.debug("## smartIdentity: Draft()\n");
    142143       
    143144        this.__SmartDraftOrReplyOnSent();
     
    158159    __SmartDraftOrReplyOnSent : function() {
    159160        if (!this._pref.getBoolPref("smart_draft"))
    160             { MyLog.debug("## smartIdentity: SmartDraft deactivated\n"); return; }
    161 
    162         MyLog.debug("## smartIdentity: __SmartDraftOrReplyOnSent()\n");
     161            { Log.debug("## smartIdentity: SmartDraft deactivated\n"); return; }
     162
     163        Log.debug("## smartIdentity: __SmartDraftOrReplyOnSent()\n");
    163164
    164165        if (this._msgHdr) {
    165166            this.__parseHeadersWithArray(this._msgHdr.author, this._allIdentities)
    166             MyLog.debug("## smartIdentity: sender '" + this._allIdentities.identityDataCollection[0].combinedName + "'\n");
    167         }
    168         else MyLog.debug("## smartIdentity: __SmartDraftOrReplyOnSent: No Header found, shouldn't happen\n");
     167            Log.debug("## smartIdentity: sender '" + this._allIdentities.identityDataCollection[0].combinedName + "'\n");
     168        }
     169        else Log.debug("## smartIdentity: __SmartDraftOrReplyOnSent: No Header found, shouldn't happen\n");
    169170    },
    170171   
     
    180181            var recentfilterType; var skipRegExp = false;
    181182            if (filterList.length <= 1 && filterList[0] == "")
    182                 { MyLog.debug("## smartIdentity: no filters configured\n"); recentfilterType = filterType.None; }
     183                { Log.debug("## smartIdentity: no filters configured\n"); recentfilterType = filterType.None; }
    183184            else if (/^[+-]?\/(.*)\/$/.exec(filterList[i]))
    184                 { MyLog.debug("## smartIdentity: filter emails with RegExp '"
     185                { Log.debug("## smartIdentity: filter emails with RegExp '"
    185186                    + filterList[i].replace(/\\/g,"\\\\") + "'\n"); recentfilterType = filterType.RegExp; }
    186             else    { MyLog.debug("## smartIdentity: filter emails, compare with '"
     187            else    { Log.debug("## smartIdentity: filter emails, compare with '"
    187188                    + filterList[i] + "'\n"); recentfilterType = filterType.StrCmp; }
    188189            for (var j = 0; j < this._allIdentities.number; j++) { // check if recent email-address (pre-choosen identity) is found in
     
    202203                        }
    203204                        catch(vErr) {
    204                             addNote(
     205                            SmartReplyNotification.info(
    205206                                vI.main.elements.strings.getString("vident.smartIdentity.ignoreRegExp") +
    206                                 +filterList[i].replace(/\\/g,"\\\\") + " .",
    207                                 "smart_reply_notification");
     207                                +filterList[i].replace(/\\/g,"\\\\") + " .");
    208208                                skipRegExp = true; }
    209209                        break;
     
    240240            // if mailing-list ignore to-header (usually the mailing list address)
    241241            if (replyHeaderNameToRead == "to" && this._msgHdr.getStringProperty("vI_list-id")) {
    242                 MyLog.debug("## smartIdentity: header 'list-id' found (mailinglist), skipping header 'to'\n");
     242                Log.debug("## smartIdentity: header 'list-id' found (mailinglist), skipping header 'to'\n");
    243243                continue;
    244244            }
     
    250250                 .getMostRecentWindow("mail:3pane");
    251251           
    252             MyLog.debug("## smartIdentity: found stored header '" +
     252            Log.debug("## smartIdentity: found stored header '" +
    253253                replyHeaderNameToRead + "': '" + window3pane.virtualIdentityExtension.storedHeaders["vI_" + replyHeaderNameToRead] + "'\n");*/
    254254           
    255             MyLog.debug("## smartIdentity: reading header '" +
     255            Log.debug("## smartIdentity: reading header '" +
    256256                replyHeaderNameToRead + "': '" + value + "'\n");
    257257           
     
    264264                // if there is no email than it makes no sense to use it as a sender
    265265                if (!splitted.identityDataCollection[i].email.match(/^.*@.*$/)) {
    266                     MyLog.debug("## smartIdentity:   skipping '" +
     266                    Log.debug("## smartIdentity:   skipping '" +
    267267                    splitted.identityDataCollection[i].email + "', no email\n")
    268268                    continue;
     
    273273                this._allIdentities.addWithoutDuplicates(splitted.identityDataCollection[i]);
    274274
    275                 MyLog.debug("## smartIdentity:   found '" +
     275                Log.debug("## smartIdentity:   found '" +
    276276                    splitted.identityDataCollection[i].combinedName + "'\n")
    277277            }
     
    280280   
    281281    Reply : function() {
    282         MyLog.debug("## smartIdentity: Reply()\n");
     282        Log.debug("## smartIdentity: Reply()\n");
    283283
    284284        if (this._msgHdr && this._newsgroup && !this._msgHdr.getStringProperty("vI_content_base")) {
     
    294294            if (this._pref.getBoolPref("smart_detectByReceivedHeader")) {
    295295                if (!this._msgHdr.getStringProperty("vI_received")) { // mail was not received
    296                     MyLog.debug("## smartIdentity: reply on non-received (sent?) mail. Using SmartDraft. \n");
     296                    Log.debug("## smartIdentity: reply on non-received (sent?) mail. Using SmartDraft. \n");
    297297                    this.ReplyOnSent();
    298298                    return;
     
    305305
    306306                if (this._msgHdr && (this._msgHdr.folder.flags & MSG_FOLDER_FLAG_SENTMAIL)) {
    307                     MyLog.debug("## smartIdentity: reply from Sent folder.");
     307                    Log.debug("## smartIdentity: reply from Sent folder.");
    308308                    if (this._msgHdr.folder.flags & MSG_FOLDER_FLAG_INBOX)
    309                         MyLog.debug(" Folder is INBOX, assuming Reply-Case. \n");
     309                        Log.debug(" Folder is INBOX, assuming Reply-Case. \n");
    310310                    else {
    311                         MyLog.debug(" Using SmartDraft. \n");
     311                        Log.debug(" Using SmartDraft. \n");
    312312                        this.ReplyOnSent();
    313313                        return;
     
    324324        if (storageIdentities.number == 0 || !this._pref.getBoolPref("idSelection_storage_ignore_smart_reply"))
    325325            this.__SmartReply();
    326         else MyLog.debug("## smartIdentity: SmartReply skipped, Identities in Storage found.\n");
     326        else Log.debug("## smartIdentity: SmartReply skipped, Identities in Storage found.\n");
    327327
    328328        // merge SmartReply-Identities and Storage-Identites
     
    335335        }
    336336       
    337         MyLog.debug("## smartIdentity: merged SmartReply & Storage, " + this._allIdentities.number + " address(es) left\n")
     337        Log.debug("## smartIdentity: merged SmartReply & Storage, " + this._allIdentities.number + " address(es) left\n")
    338338    },
    339339   
     
    341341    __SmartReply : function() {
    342342        if (!this._pref.getBoolPref("smart_reply"))
    343             { MyLog.debug("## smartIdentity: SmartReply deactivated\n"); return; }
     343            { Log.debug("## smartIdentity: SmartReply deactivated\n"); return; }
    344344        if (this._newsgroup && !this._pref.getBoolPref("smart_reply_for_newsgroups")) {
    345             MyLog.debug("## smartIdentity: SmartReply, answering to a newsgroup, aborting\n");
     345            Log.debug("## smartIdentity: SmartReply, answering to a newsgroup, aborting\n");
    346346            return;
    347347        }
    348348
    349         MyLog.debug("## smartIdentity: __SmartReply()\n");
    350         MyLog.debug("## smartIdentity: ----------------------------------------------------------\n")
     349        Log.debug("## smartIdentity: __SmartReply()\n");
     350        Log.debug("## smartIdentity: ----------------------------------------------------------\n")
    351351        if (this._msgHdr) {
    352352            /* first step: collect addresses */
    353353            this.__smartReplyCollectAddresses();
    354             MyLog.debug("## smartIdentity: " + this._allIdentities.number + " address(es) after parsing, before filtering\n")
     354            Log.debug("## smartIdentity: " + this._allIdentities.number + " address(es) after parsing, before filtering\n")
    355355           
    356356            /* second step: filter (and sort) addresses */
    357357            this.__filterAddresses();
    358358           
    359             MyLog.debug("## smartIdentity: filtering done, " + this._allIdentities.number + " address(es) left\n")
     359            Log.debug("## smartIdentity: filtering done, " + this._allIdentities.number + " address(es) left\n")
    360360           
    361361            /* set default FullName */
     
    365365                    if (this._allIdentities.identityDataCollection[index].fullName == "") {
    366366                        this._allIdentities.identityDataCollection[index].fullName = smart_reply_defaultFullName
    367                         MyLog.debug("## smartIdentity: added default FullName '" +
     367                        Log.debug("## smartIdentity: added default FullName '" +
    368368                            smart_reply_defaultFullName + "' to '" + this._allIdentities.identityDataCollection[index].email + "'\n")
    369369                    }
     
    375375            /* will not be added to the menu but probably choosen with __smartIdentitySelection     */
    376376            if (this._pref.getBoolPref("smart_reply_ignoreFullName")) {
    377                 MyLog.debug("## smartIdentity: compare with existing Identities (ignoring FullNames).\n")
     377                Log.debug("## smartIdentity: compare with existing Identities (ignoring FullNames).\n")
    378378           
    379379                for (var index = 0; index < this._allIdentities.number; index++) {
     
    382382                        var newFullName = gAccountManager.getIdentity(idKey).fullName;
    383383                        this._allIdentities.identityDataCollection[index].fullName = newFullName;
    384                         MyLog.debug("## smartIdentity: replaced Fullname of '" + this._allIdentities.identityDataCollection[index].email + "' with '" + newFullName + "' \n");
     384                        Log.debug("## smartIdentity: replaced Fullname of '" + this._allIdentities.identityDataCollection[index].email + "' with '" + newFullName + "' \n");
    385385                    }
    386386                }
    387387            }
    388388        }
    389         else MyLog.debug("## smartIdentity: SmartReply skipped. No Header-information found.\n");
    390        
    391         MyLog.debug("## smartIdentity: ----------------------------------------------------------\n")
     389        else Log.debug("## smartIdentity: SmartReply skipped. No Header-information found.\n");
     390       
     391        Log.debug("## smartIdentity: ----------------------------------------------------------\n")
    392392    },
    393393   
  • content/prefDialog/vI_prefDialog.js

    r021dbf rc0a8de  
    2626
    2727Components.utils.import("resource://gre/modules/AddonManager.jsm");
     28let Log = setupLogging("virtualIdentity.prefDialog");
    2829
    2930var prefDialog = {
     
    143144                        else {
    144145                            element.setAttribute("value",
    145                             prefDialog.unicodeConverter.ConvertToUnicode(prefDialog.preferences.getCharPref(element.getAttribute("prefstring"))) );
     146                            prefDialog.unicodeConverter.ConvertToUnicode(prefDia/*log*/.preferences.getCharPref(element.getAttribute("prefstring"))) );
    146147//                          alert(element.getAttribute("prefstring") + " " + element.getAttribute("value"))
    147148                        }
     
    338339    },
    339340
    340         openURL : function(aURL) {
    341             var uri = Components.classes["@mozilla.org/network/standard-url;1"].createInstance(Components.interfaces.nsIURI);
    342             var protocolSvc = Components.classes["@mozilla.org/uriloader/external-protocol-service;1"].getService(Components.interfaces.nsIExternalProtocolService);
    343         dump("load url " + aURL + "\n");
    344             uri.spec = aURL;
    345             protocolSvc.loadUrl(uri);
    346         }
     341    openURL : function(aURL) {
     342        var uri = Components.classes["@mozilla.org/network/standard-url;1"].createInstance(Components.interfaces.nsIURI);
     343        var protocolSvc = Components.classes["@mozilla.org/uriloader/external-protocol-service;1"].getService(Components.interfaces.nsIExternalProtocolService);
     344        Log.debug("load url " + aURL + "\n");
     345        uri.spec = aURL;
     346        protocolSvc.loadUrl(uri);
     347    }
    347348}
    348349vI.prefDialog = prefDialog;
  • content/vI_getHeader.js

    r021dbf rc0a8de  
    7171    getHeader: function() {
    7272      clearDebugOutput();
    73       Log.debug("\n");
    74      
    7573      if (!getHeader.headerToSearch) getHeader.prefObserverToSearchArray()
    7674     
    7775      msgHdrGetHeaders(getHeader.hdr, function (aHeaders) {
     76        let label = "";
    7877        if (aHeaders.has("list-id")) {
    7978          getHeader.hdr.setStringProperty("vI_list-id","found");
     
    9897            Log.debug("## getHeader: found header: " + headerNameToSearch +
    9998                " - stored as '" + storedConvValue + "'\n");
     99            label += (label)?"\n":""
     100            label += headerNameToSearch + ":\t" + storedConvValue
    100101          }
    101102        }
     103        GetHeaderNotification.info(label + ".");
    102104      });
    103105    },
  • content/vI_msgIdentityCloneTools.js

    r021dbf rc0a8de  
    2323 * ***** END LICENSE BLOCK ***** */
    2424virtualIdentityExtension.ns(function() { with (virtualIdentityExtension.LIB) {
     25
     26Components.utils.import("resource://v_identity/stdlib/msgHdrUtils.js");
     27let Log = setupLogging("virtualIdentity.msgIdentityCloneTools");
     28
    2529var msgIdentityCloneTools = {   
    2630    _pref : Components.classes["@mozilla.org/preferences-service;1"]
     
    2933
    3034    copySelectedIdentity : function(id_key) {
    31         MyLog.debug("## msgIdentityCloneTools: copySelectedIdentity\n");
     35        Log.debug("## msgIdentityCloneTools: copySelectedIdentity\n");
    3236        var msgIdentityElem = document.getElementById("msgIdentity");
    3337        var msgIdentityPopupElem = document.getElementById("msgIdentityPopup");
     
    4852        try { setSecuritySettings(1); enigSetMenuSettings(''); } catch(vErr) { };
    4953        if (!existingIdentity) {
    50             MyLog.debug("## msgIdentityCloneTools: signatureSwitch hide/remove signatures\n");
     54            Log.debug("## msgIdentityCloneTools: signatureSwitch hide/remove signatures\n");
    5155            // code to hide the text signature
    5256            try { if (msgIdentityCloneTools._pref.getBoolPref("hide_signature") && ss_signature.length == 0) {
    53                 MyLog.debug("## msgIdentityCloneTools: hide text/html signature");
     57                Log.debug("## msgIdentityCloneTools: hide text/html signature");
    5458                ss_main.signatureSwitch()
    55                 MyLog.debug("\n");
    56             } } catch(vErr) { MyLog.debug(" -- missing signatureSwitch extension?\n"); };
     59                Log.debug("\n");
     60            } } catch(vErr) { Log.debug(" -- missing signatureSwitch extension?\n"); };
    5761            // code to hide the sMime signature
    5862            try { if (msgIdentityCloneTools._pref.getBoolPref("hide_sMime_messageSignature")) {
    5963                var element = document.getElementById("menu_securitySign1");
    6064                if (element.getAttribute("checked") == "true") {
    61                     MyLog.debug("## signatureSwitch hide_sMime_messageSignature with doCommand\n");
     65                    Log.debug("## signatureSwitch hide_sMime_messageSignature with doCommand\n");
    6266                    element.doCommand();
    6367                }
     
    7882                    }
    7983                    if (skipChangeGPGsign)
    80                         MyLog.debug("## signatureSwitch skip hide_openPGP_messageSignature - EnigMail AlertWindow open\n");
     84                        Log.debug("## signatureSwitch skip hide_openPGP_messageSignature - EnigMail AlertWindow open\n");
    8185                    else {
    82                         MyLog.debug("## signatureSwitch hide_openPGP_messageSignature with doCommand\n");
     86                        Log.debug("## signatureSwitch hide_openPGP_messageSignature with doCommand\n");
    8387                        element.doCommand();
    8488                    }
     
    8993        }
    9094        else {
    91             MyLog.debug("## msgIdentityCloneTools: signatureSwitch restore signature\n");
     95            Log.debug("## msgIdentityCloneTools: signatureSwitch restore signature\n");
    9296            // code to show the text signature
    9397            try { if (ss_signature.length > 0) {
    94                 MyLog.debug("## msgIdentityCloneTools: show text/html signature");
     98                Log.debug("## msgIdentityCloneTools: show text/html signature");
    9599                ss_main.signatureSwitch()
    96                 MyLog.debug("\n");
    97             } } catch(vErr) { MyLog.debug(" -- missing signatureSwitch extension?\n"); };
     100                Log.debug("\n");
     101            } } catch(vErr) { Log.debug(" -- missing signatureSwitch extension?\n"); };
    98102            // sMime and openGPG signature will not be re-added automatically
    99103        }
     
    113117                var awType = awGetPopupElement(row).selectedItem.getAttribute("value");
    114118                if (awType == "addr_reply") {
    115                     MyLog.debug("## msgIdentityCloneTools: removed ReplyTo found in row " + row + "\n");
     119                    Log.debug("## msgIdentityCloneTools: removed ReplyTo found in row " + row + "\n");
    116120                    awDeleteRow(row--); // removed one line therefore decrease row-value
    117121                }
     
    123127        if (!document.getElementById("autoReplyToSelfLabel").hasAttribute("hidden")) {
    124128            awAddRecipient("addr_reply",document.getElementById("msgIdentity_clone").label);
    125             MyLog.debug("## msgIdentityCloneTools: added ReplyToSelf");
     129            Log.debug("## msgIdentityCloneTools: added ReplyToSelf");
    126130            document.getElementById("autoReplyToSelfLabel").setAttribute("hidden","true");
    127131        }
  • content/vI_rdfDataTree.js

    r021dbf rc0a8de  
    3030
    3131virtualIdentityExtension.ns(function() { with (virtualIdentityExtension.LIB) {
     32
     33Components.utils.import("resource://v_identity/stdlib/msgHdrUtils.js");
     34let Log = setupLogging("virtualIdentity.rdfDataTree");
     35
    3236//prepares an object for easy comparison against another. for strings, lowercases them
    3337function prepareForComparison (o) {
     
    5761    //this function is called every time the tree is sorted, filtered, or reloaded
    5862    loadTable : function() {
    59 //         MyLog.debug("## rdfDataTree: loadTable.\n");
     63//         Log.debug("## rdfDataTree: loadTable.\n");
    6064        //remember scroll position. this is useful if this is an editable table
    6165        //to prevent the user from losing the row they edited
     
    9397        // set Tab label
    9498        this.tabElem.setAttribute("label", this.treeType + " (" + this.idTable.length + ")");
    95 //         MyLog.debug("## rdfDataTree: loadTable done.\n");
     99//         Log.debug("## rdfDataTree: loadTable done.\n");
    96100    },
    97101
     
    106110                resource : resource,
    107111                identityData : localIdentityData}
    108 //      MyLog.debug("## addNewDatum.\n");
     112//      Log.debug("## addNewDatum.\n");
    109113        localIdentityData.extras.addPrefs(pref);
    110114        idData.push(pref);
    111115    },
    112116    sort : function(columnName) {
    113 //      MyLog.debug("## sort: " + columnName + ".\n");
     117//      Log.debug("## sort: " + columnName + ".\n");
    114118        var order = this.treeElem.getAttribute("sortDirection") == "ascending" ? 1 : -1;
    115119        //if the column is passed and it's already sorted by that column, reverse sort
  • content/vI_smartIdentity.js

    r021dbf rc0a8de  
    2626
    2727Components.utils.import("resource://v_identity/vI_log.js");
     28let Log = setupLogging("virtualIdentity.smartIdentity");
    2829
    2930var smartIdentity = {
     
    4344        var newsgroup = gMsgCompose.compFields.newsgroups;
    4445        var autocreate = false;
    45         MyLog.debug("## smartIdentity: msgComposeTypeReference = " + gMsgCompose.type + "\n");
     46        Log.debug("## smartIdentity: msgComposeTypeReference = " + gMsgCompose.type + "\n");
    4647        switch (gMsgCompose.type) {
    4748            case msgComposeTypeReference.Reply:
     
    5253            case msgComposeTypeReference.ReplyWithTemplate:
    5354            case msgComposeTypeReference.ReplyToList:
    54                 MyLog.debug("## smartIdentity: Reply\n");
     55                Log.debug("## smartIdentity: Reply\n");
    5556                msgHdr = smartIdentity.messenger.
    5657                    messageServiceFromURI(gMsgCompose.originalMsgURI).messageURIToMsgHdr(gMsgCompose.originalMsgURI);
     
    6061            case msgComposeTypeReference.Draft:
    6162            case msgComposeTypeReference.Template:
    62                 MyLog.debug("## smartIdentity: Draft\n");
     63                Log.debug("## smartIdentity: Draft\n");
    6364                msgHdr = smartIdentity.messenger.
    6465                    messageServiceFromURI(gMsgCompose.compFields.draftId).messageURIToMsgHdr(gMsgCompose.compFields.draftId);
     
    7172            case msgComposeTypeReference.NewsPost:
    7273            case msgComposeTypeReference.MailToUrl:
    73                 MyLog.debug("## smartIdentity: New Mail\n");
     74                Log.debug("## smartIdentity: New Mail\n");
    7475                smartIdentity._smartIdentityCollection = new vI.smartIdentityCollection(null, getCurrentIdentity(), document.getElementById("msgIdentity_clone").vid, newsgroup, this._getRecipients());   
    7576                // to enable composing new email with new identity: identity is hidden in subject line
     
    7778                var subject = gMsgCompose.compFields.subject.split(/\n/);
    7879                if (subject.length > 1 && subject[1] == "virtualIdentityExtension") {
    79                     MyLog.debug("## smartIdentity: NewMail() found stored identity preset: " + subject[2] + "\n");
     80                    Log.debug("## smartIdentity: NewMail() found stored identity preset: " + subject[2] + "\n");
    8081                    smartIdentity._smartIdentityCollection.__parseHeadersWithArray(subject[2], smartIdentity._smartIdentityCollection._allIdentities);
    8182                    gMsgCompose.compFields.subject = subject[0];
     
    100101   
    101102    __smartIdentitySelection : function(autocreate) {
    102         MyLog.debug("## __smartIdentitySelection autocreate=" + autocreate + "\n");
     103        Log.debug("## __smartIdentitySelection autocreate=" + autocreate + "\n");
    103104       
    104105        if (smartIdentity._pref.getBoolPref("idSelection_preferExisting")) {
    105106            var existingIDIndex = smartIdentity._smartIdentityCollection._foundExistingIdentity();
    106107            if (existingIDIndex) {
    107                 MyLog.debug("## smartIdentity: found existing Identity, use without interaction.\n");
     108                Log.debug("## smartIdentity: found existing Identity, use without interaction.\n");
    108109                // add all Indentities to Clone Menu before selecting and leaving the function
    109110                document.getElementById("msgIdentity_clone").addIdentitiesToCloneMenu(smartIdentity._smartIdentityCollection._allIdentities);
     
    114115       
    115116        document.getElementById("msgIdentity_clone").addIdentitiesToCloneMenu(smartIdentity._smartIdentityCollection._allIdentities);
    116         MyLog.debug("## __smartIdentitySelection smartIdentity._smartIdentityCollection._allIdentities.number=" +
     117        Log.debug("## __smartIdentitySelection smartIdentity._smartIdentityCollection._allIdentities.number=" +
    117118                smartIdentity._smartIdentityCollection._allIdentities.number +
    118119                " smartIdentity._pref.getBoolPref('idSelection_ask_always')=" +
     
    124125                || smartIdentity._smartIdentityCollection._allIdentities.number > 1)) {
    125126            for (var index = 0; index < smartIdentity._smartIdentityCollection._allIdentities.number; index++) {
    126                 MyLog.debug("## smartIdentityReplyDialog index=" + index + ": '" + smartIdentity._smartIdentityCollection._allIdentities.identityDataCollection[index].combinedName + "' "
     127                Log.debug("## smartIdentityReplyDialog index=" + index + ": '" + smartIdentity._smartIdentityCollection._allIdentities.identityDataCollection[index].combinedName + "' "
    127128                    + "(" + smartIdentity._smartIdentityCollection._allIdentities.identityDataCollection[index].id.value + "," + smartIdentity._smartIdentityCollection._allIdentities.identityDataCollection[index].smtp.value + ")\n");
    128129            }
     
    138139   
    139140    changeIdentityToSmartIdentity : function(allIdentities, selectedValue) {
    140         MyLog.debug("## changeIdentityToSmartIdentity selectedValue=" + selectedValue + " from " + allIdentities.number + "\n");
    141         MyLog.debug("## changeIdentityToSmartIdentity selectedValue=" + selectedValue + ": '" + allIdentities.identityDataCollection[selectedValue].combinedName + "' "
     141        Log.debug("## changeIdentityToSmartIdentity selectedValue=" + selectedValue + " from " + allIdentities.number + "\n");
     142        Log.debug("## changeIdentityToSmartIdentity selectedValue=" + selectedValue + ": '" + allIdentities.identityDataCollection[selectedValue].combinedName + "' "
    142143            + "(" + allIdentities.identityDataCollection[selectedValue].id.value + "," + allIdentities.identityDataCollection[selectedValue].smtp.value + ")\n");
    143144        document.getElementById("msgIdentity_clone").selectedMenuItem = allIdentities.menuItems[selectedValue];
     
    146147            if (allIdentities.number > 1) label += " "
    147148                + vI.main.elements.strings.getString("vident.smartIdentity.moreThanOne");
    148             addNote(label + ".", "smart_reply_notification");
     149            SmartReplyNotification.info(label + ".");
    149150        }
    150151        smartIdentity.__removeSmartIdentityFromRecipients(allIdentities, selectedValue);
     
    189190                    awSetInputAndPopupValue(input, "", popup, "addr_to", -1);
    190191                    awCleanupRows()
    191                     addNote(" " +
    192                         vI.main.elements.strings.getString("vident.smartIdentity.remRecipient"),
    193                         "smart_reply_notification");
     192                    SmartReplyNotification.info(" " +   vI.main.elements.strings.getString("vident.smartIdentity.remRecipient"));
    194193                    break;
    195194            }
  • content/vI_storage.js

    r021dbf rc0a8de  
    3232Components.utils.import("resource://gre/modules/AddonManager.jsm");
    3333Components.utils.import("resource://v_identity/vI_log.js");
    34 
     34let Log = setupLogging("virtualIdentity.storage");
    3535
    3636var storage = {
     
    4646
    4747    clean: function() {
    48         MyLog.debug("## storage: clean.\n");
     48        Log.debug("## storage: clean.\n");
    4949        storage.multipleRecipients = null;
    5050        storage.lastCheckedEmail = {};
     
    6060    replacement_functions : {
    6161        awSetInputAndPopupValue : function (inputElem, inputValue, popupElem, popupValue, rowNumber) {
    62             MyLog.debug("## storage: awSetInputAndPopupValue '" + inputElem.id +"'\n");
     62            Log.debug("## storage: awSetInputAndPopupValue '" + inputElem.id +"'\n");
    6363            storage.original_functions.awSetInputAndPopupValue(inputElem, inputValue, popupElem, popupValue, rowNumber);
    6464            storage.updateVIdentityFromStorage(inputElem);
     
    6969        // only react on events triggered by addressCol2 - textinput Elements
    7070        if (!element || ! element.id.match(/^addressCol2*/)) return;
    71         MyLog.debug("\n## storage: awOnBlur '" + element.id +"'\n");
     71        Log.debug("\n## storage: awOnBlur '" + element.id +"'\n");
    7272        storage.updateVIdentityFromStorage(element);
    7373        storage.focusedElement = null;
     
    8080
    8181    awPopupOnCommand : function (element) {
    82         MyLog.debug("\n## storage: awPopupOnCommand'" + element.id +"'\n");
     82        Log.debug("\n## storage: awPopupOnCommand'" + element.id +"'\n");
    8383        storage.updateVIdentityFromStorage(document.getElementById(element.id.replace(/^addressCol1/,"addressCol2")));
    8484        if (element.selectedItem.getAttribute("value") == "addr_reply") // if reply-to is manually entered disable AutoReplyToSelf
     
    132132    updateVIdentityFromStorage: function(inputElement) {
    133133        if (!storage._pref.getBoolPref("storage"))
    134             { MyLog.debug("## storage: Storage deactivated\n"); return; }
    135         MyLog.debug("## storage: updateVIdentityFromStorage()\n");
     134            { Log.debug("## storage: Storage deactivated\n"); return; }
     135        Log.debug("## storage: updateVIdentityFromStorage()\n");
    136136
    137137        var recipientType = document.getElementById(inputElement.id.replace(/^addressCol2/,"addressCol1"))
     
    142142            if (storage.firstUsedInputElement == inputElement)
    143143                storage.firstUsedInputElement = null;
    144             MyLog.debug("## storage: field is a 'reply-to' or 'followup-to' or preconfigured 'doBcc'. not searched.\n")
     144            Log.debug("## storage: field is a 'reply-to' or 'followup-to' or preconfigured 'doBcc'. not searched.\n")
    145145            return;
    146146        }
    147147       
    148148        if (inputElement.value == "") {
    149             MyLog.debug("## storage: no recipient found, not checked.\n"); return;
     149            Log.debug("## storage: no recipient found, not checked.\n"); return;
    150150        }
    151151       
    152152        var row = inputElement.id.replace(/^addressCol2#/,"")
    153153        if (storage.lastCheckedEmail[row] && storage.lastCheckedEmail[row] == inputElement.value) {
    154             MyLog.debug("## storage: same email than before, not checked again.\n"); return;
     154            Log.debug("## storage: same email than before, not checked again.\n"); return;
    155155        }
    156156        storage.lastCheckedEmail[row] = inputElement.value;
     
    163163       
    164164        if (storageResult.identityCollection.number == 0) return; // return if there was no match
    165         MyLog.debug("## storage: updateVIdentityFromStorage result: " + storageResult.result + "\n");
     165        Log.debug("## storage: updateVIdentityFromStorage result: " + storageResult.result + "\n");
    166166        // found storageData, so store InputElement
    167167        if (!storage.firstUsedInputElement) storage.firstUsedInputElement = inputElement;
     
    170170        if (storageResult.result != "equal") {
    171171            for (var j = 0; j < storageResult.identityCollection.number; j++) {
    172                 MyLog.debug("## storage: updateVIdentityFromStorage adding: " + storageResult.identityCollection.identityDataCollection[j].combinedName + "\n");
     172                Log.debug("## storage: updateVIdentityFromStorage adding: " + storageResult.identityCollection.identityDataCollection[j].combinedName + "\n");
    173173                selectedMenuItem = document.getElementById("msgIdentity_clone").addIdentityToCloneMenu(storageResult.identityCollection.identityDataCollection[j])
    174174            }
    175175        }
    176176        if (storageResult.result == "accept") {
    177             MyLog.debug("## storage: updateVIdentityFromStorage selecting: " + storageResult.identityCollection.identityDataCollection[0].combinedName + "\n");
     177            Log.debug("## storage: updateVIdentityFromStorage selecting: " + storageResult.identityCollection.identityDataCollection[0].combinedName + "\n");
    178178            document.getElementById("msgIdentity_clone").selectedMenuItem = selectedMenuItem;
    179179            if (document.getElementById("msgIdentity_clone").vid)
    180                 setNote(vI.main.elements.strings.getString("vident.smartIdentity.vIStorageUsage") + ".",
    181                     "storage_notification");
     180                StorageNotification.info(vI.main.elements.strings.getString("vident.smartIdentity.vIStorageUsage") + ".");
    182181        }
    183182    },
     
    191190        for (var index = 0; index < doBccArray.count; index++ ) {
    192191            if (doBccArray.StringAt(index) == awGetInputElement(row).value) {
    193                 MyLog.debug("## storage: ignoring doBcc field '" +
     192                Log.debug("## storage: ignoring doBcc field '" +
    194193                    doBccArray.StringAt(index) + "'.\n");
    195194                return true;
  • content/vI_storageExtras.js

    r021dbf rc0a8de  
    2323
    2424virtualIdentityExtension.ns(function() { with (virtualIdentityExtension.LIB) {
     25
     26Components.utils.import("resource://v_identity/stdlib/msgHdrUtils.js");
     27let Log = setupLogging("virtualIdentity.storageExtras");
     28
    2529function storageExtras_adapt(sourceId, targetId) {
    2630    var checked = document.getElementById(sourceId).getAttribute("checked");
     
    9094    loopForRDF : function(rdfDatasource, resource, type) {
    9195        for( var i = 0; i < this.extras.length; i++ ) {
    92 //          MyLog.debug("## vI.rdfDatasource: loopForRDF " + rdfDatasource + "\n");
     96//          Log.debug("## vI.rdfDatasource: loopForRDF " + rdfDatasource + "\n");
    9397            // only if pref set and feature(element available) or for dataEditor
    9498            if (typeof(gMsgCompose) == "undefined" || !gMsgCompose || this.extras[i].active) {
     
    167171        for( var i = 0; i < this.extras.length; i++ ) {
    168172            if (this.extras[i].active) this.extras[i].readIdentityValue(identity)
    169 //          MyLog.debug("## storageExtras readIdentityValues "+ this.extras[i].field + "=" + this.extras[i].value + "\n");
     173//          Log.debug("## storageExtras readIdentityValues "+ this.extras[i].field + "=" + this.extras[i].value + "\n");
    170174        }
    171175    },
     
    174178        for( var i = 0; i < this.extras.length; i++ ) {
    175179            if (this.extras[i].active) this.extras[i].setValue()
    176 //          MyLog.debug("## storageExtras setValue "+ this.extras[i].field + "=" + this.extras[i].value + "\n");
     180//          Log.debug("## storageExtras setValue "+ this.extras[i].field + "=" + this.extras[i].value + "\n");
    177181        }
    178182    },
    179183    readValues : function() {
    180184        for( var i = 0; i < this.extras.length; i++ ) {
    181 //          MyLog.debug("## storageExtras preparing readValue "+ this.extras[i].field +"\n");
     185//          Log.debug("## storageExtras preparing readValue "+ this.extras[i].field +"\n");
    182186            if (this.extras[i].active) this.extras[i].readValue()
    183 //              MyLog.debug("## storageExtras readValue "+ this.extras[i].field + "=" + this.extras[i].value + "\n");
     187//              Log.debug("## storageExtras readValue "+ this.extras[i].field + "=" + this.extras[i].value + "\n");
    184188        }
    185189    },
     
    190194        for( var i = 0; i < this.extras.length; i++ ) {
    191195            this.extras[i].readEditorValue();
    192 //          MyLog.debug("## storageExtras readValue " + this.extras[i].field + "=" + this.extras[i].value + "\n");
     196//          Log.debug("## storageExtras readValue " + this.extras[i].field + "=" + this.extras[i].value + "\n");
    193197        }
    194198    },
     
    376380    // function to set or read the value from/to the MessageCompose Dialog
    377381    setValue : function() {
    378         MyLog.debug("## storageExtras_sMime_messageEncryption \n");
     382        Log.debug("## storageExtras_sMime_messageEncryption \n");
    379383        var doEncryptElem = document.getElementById("menu_securityEncryptRequire1");
    380384        if (this.value == null) return;
     
    458462
    459463        if ((element.getAttribute("checked") == "true") != (this.value == "true")) {
    460             MyLog.debug("## storageExtras change "+ this.field + " to " + this.value + " with doCommand\n");
     464            Log.debug("## storageExtras change "+ this.field + " to " + this.value + " with doCommand\n");
    461465            element.doCommand();
    462466        }
  • content/vI_upgrade.js

    r021dbf rc0a8de  
    2424
    2525virtualIdentityExtension.ns(function() { with (virtualIdentityExtension.LIB) {
     26
     27Components.utils.import("resource://v_identity/stdlib/msgHdrUtils.js");
     28let Log = setupLogging("virtualIdentity.upgrade");
     29
    2630var upgrade = {
    2731    preferences : Components.classes["@mozilla.org/preferences-service;1"]
     
    4448
    4549    __initRequirements : function() {
    46         MyLog.debug("") // this initialises the debug-area
     50        Log.debug("") // this initialises the debug-area
    4751        upgrade.rdfDatasource = new vI.rdfDatasource("virtualIdentity.rdf", true);
    4852    },
     
    6771        // don't show the dialog if we do a one-step upgrade
    6872        if (upgrade.versionChecker.compare(extVersion, nextVersion) <= 0) {
    69             MyLog.debug("starting quick_upgrade.\n")
     73            Log.debug("starting quick_upgrade.\n")
    7074            upgrade.__initRequirements();
    7175            upgrade.__upgrade();
     
    9296
    9397    upgrade : function() {
    94         MyLog.debug("starting upgrade.\n\n")
     98        Log.debug("starting upgrade.\n\n")
    9599        document.getElementById("upgradeWizard").setAttribute("canAdvance", "false")
    96100        document.documentElement.getButton('next').setAttribute('disabled','true');
     
    98102        upgrade.__upgrade();
    99103   
    100         MyLog.debug("\n\nupgrade finished.\n");
     104        Log.debug("\n\nupgrade finished.\n");
    101105       
    102106        document.documentElement.getButton('next').setAttribute('disabled','false');
     
    106110    extUpgrade : function() {
    107111        var currentVersion = upgrade.rdfDatasource.getCurrentExtFileVersion();
    108         MyLog.debug("checking for previous version, found " +
     112        Log.debug("checking for previous version, found " +
    109113            currentVersion + "\nextension-upgrade required.\n")
    110114        switch (currentVersion) {
     
    117121        }
    118122        upgrade.rdfDatasource.storeExtVersion();
    119         MyLog.debug("extension-upgrade to " + upgrade.rdfDatasource.getCurrentExtFileVersion() + " done.\n\n");
     123        Log.debug("extension-upgrade to " + upgrade.rdfDatasource.getCurrentExtFileVersion() + " done.\n\n");
    120124    },
    121125   
     
    125129            .getBranch(null);
    126130       
    127         MyLog.debug("extension-upgrade __removeExtraAddedHeaders " + currentVersion + "\n");
     131        Log.debug("extension-upgrade __removeExtraAddedHeaders " + currentVersion + "\n");
    128132        if ((!currentVersion || upgrade.versionChecker.compare(currentVersion, "0.6.9") < 0) &&
    129133                prefroot.getCharPref("mailnews.headers.extraExpandedHeaders") != "") {
    130134            // clean extraExpandedHeaders once, because the whole header-saving and restoring was broken too long
    131             MyLog.debug("cleaning extraExpandedHeaders\n");
     135            Log.debug("cleaning extraExpandedHeaders\n");
    132136            prefroot.setCharPref("mailnews.headers.extraExpandedHeaders", "")
    133             MyLog.debug("cleaned extraExpandedHeaders\n");
     137            Log.debug("cleaned extraExpandedHeaders\n");
    134138        }
    135         MyLog.debug("extension-upgrade __removeExtraAddedHeaders done.\n\n");
     139        Log.debug("extension-upgrade __removeExtraAddedHeaders done.\n\n");
    136140    },
    137141   
     
    150154            if (!currentVersion || (upgrade.versionChecker.compare(currentVersion, transferPrefs[i].version) < 0)) {
    151155                // remove any obsolete preferences under extensions.virtualIdentity
    152                 MyLog.debug("transfer changed preferences of pre-" + transferPrefs[i].version + " release:\n")
     156                Log.debug("transfer changed preferences of pre-" + transferPrefs[i].version + " release:\n")
    153157                for each (transferPref in transferPrefs[i].prefs) {
    154158                    try {   upgrade.preferences.setBoolPref(transferPref.targetPref,
    155159                            upgrade.preferences.getBoolPref(transferPref.sourcePref));
    156160                        upgrade.preferences.clearUserPref(transferPref.sourcePref);
    157                         MyLog.debug(".")
     161                        Log.debug(".")
    158162                    }
    159163                    catch (e) { };
    160164                }
    161                 MyLog.debug("done.\n")
     165                Log.debug("done.\n")
    162166            }
    163167        }
     
    183187            if (!currentVersion || (upgrade.versionChecker.compare(currentVersion, obsoletePrefs[i].version) < 0)) {
    184188                // remove any obsolete preferences under extensions.virtualIdentity
    185                 MyLog.debug("removing obsolete preferences of pre-" + obsoletePrefs[i].version + " release:\n")
     189                Log.debug("removing obsolete preferences of pre-" + obsoletePrefs[i].version + " release:\n")
    186190                for each (pref in obsoletePrefs[i].prefs) {
    187                     try { upgrade.preferences.clearUserPref(pref); MyLog.debug(".") }
     191                    try { upgrade.preferences.clearUserPref(pref); Log.debug(".") }
    188192                    catch (e) { };
    189193                }
    190                 MyLog.debug("done.\n")
     194                Log.debug("done.\n")
    191195            }
    192196        }
  • content/v_identity.js

    r021dbf rc0a8de  
    2525virtualIdentityExtension.ns(function() { with (virtualIdentityExtension.LIB) {
    2626
     27Components.utils.import("resource://v_identity/vI_log.js");
     28let Log = setupLogging("virtualIdentity.main");
     29
    2730var main = {
    2831    preferences : Components.classes["@mozilla.org/preferences-service;1"]
     
    6467    ComposeStateListener : {
    6568        NotifyComposeBodyReady: function() {
    66             MyLog.debug("## v_identity: NotifyComposeBodyReady\n");
     69            Log.debug("## v_identity: NotifyComposeBodyReady\n");
    6770            main.initSystemStage2();
    6871        },
    6972        NotifyComposeFieldsReady: function() {
    70             MyLog.debug("## v_identity: NotifyComposeFieldsReady\n");
     73            Log.debug("## v_identity: NotifyComposeFieldsReady\n");
    7174        },
    7275        ComposeProcessDone: function(aResult) {
    73             MyLog.debug("## v_identity: StateListener reports ComposeProcessDone\n");
     76            Log.debug("## v_identity: StateListener reports ComposeProcessDone\n");
    7477            main.Cleanup(); // not really required, parallel handled by main.close
    7578            vI.storage.clean();
    7679        },
    7780        SaveInFolderDone: function(folderURI) {
    78             MyLog.debug("## v_identity: SaveInFolderDone\n");
     81            Log.debug("## v_identity: SaveInFolderDone\n");
    7982            main.Cleanup();
    8083            vI.storage.clean();
     
    8487    replacement_functions : {
    8588        FillIdentityList: function(menulist) {
    86             MyLog.debug("## v_identity: mod. FillIdentityList\n");
     89            Log.debug("## v_identity: mod. FillIdentityList\n");
    8790            var accounts = queryISupportsArray(main.accountManager.accounts,
    8891                                     Components.interfaces.nsIMsgAccount);
     
    136139            vI.storage.awOnBlur(vI.storage.focusedElement);
    137140
    138             MyLog.debug("\n## v_identity: VIdentity_GenericSendMessage\n");
     141            Log.debug("\n## v_identity: VIdentity_GenericSendMessage\n");
    139142           
    140143            if (msgType == Components.interfaces.nsIMsgCompDeliverMode.Now) { vI.msgIdentityCloneTools.addReplyToSelf(); }
     
    148151            if (returnValue.update == "abort") {
    149152                main.replacement_functions.GenericSendMessageInProgress = false;
    150                 MyLog.debug("## sending: --------------  aborted  ---------------------------------\n")
     153                Log.debug("## sending: --------------  aborted  ---------------------------------\n")
    151154                return;
    152155            }
     
    155158                    msgIdentityCloneElem.selectedMenuItem = msgIdentityCloneElem.addIdentityToCloneMenu(returnValue.storedIdentity);
    156159                    main.replacement_functions.GenericSendMessageInProgress = false;
    157                     MyLog.debug("## sending: --------------  aborted  ---------------------------------\n")
     160                    Log.debug("## sending: --------------  aborted  ---------------------------------\n")
    158161                    return;
    159162            }
     
    168171            else    main.Cleanup();
    169172            main.replacement_functions.GenericSendMessageInProgress = false;
    170             //          MyLog.debug("## v_identity: original_functions.GenericSendMessage done\n");
     173            //          Log.debug("## v_identity: original_functions.GenericSendMessage done\n");
    171174        },
    172175       
    173176        replace_FillIdentityList : function() {
    174             //~ MyLog.debug("## v_identity: replace FillIdentityList \n");
     177            //~ Log.debug("## v_identity: replace FillIdentityList \n");
    175178            main.original_functions.FillIdentityList = FillIdentityList;
    176179            FillIdentityList = main.replacement_functions.FillIdentityList;
     
    181184        window.removeEventListener('compose-window-reopen', main.reopen, true);
    182185        window.removeEventListener('compose-window-close', main.close, true);
    183         MyLog.debug("## v_identity: end. remove Account if there.\n")
     186        Log.debug("## v_identity: end. remove Account if there.\n")
    184187        main.Cleanup();
    185188        vI.storage.clean();
     
    205208        for (var index = 0; index < doBccArray.count; index++ ) {
    206209            if (doBccArray.StringAt(index) == awGetInputElement(row).value) {
    207                 MyLog.debug("## main _recipientIsDoBcc: ignoring doBcc field '" +
     210                Log.debug("## main _recipientIsDoBcc: ignoring doBcc field '" +
    208211                    doBccArray.StringAt(index) + "'.\n");
    209212                return true;
     
    218221        window.removeEventListener('compose-window-init', main.init, true);
    219222        if (main.elements.Area_MsgIdentityHbox) return; // init done before, (?reopen)
    220         MyLog.debug("\n## v_identity: init.\n")
     223        Log.debug("\n## v_identity: init.\n")
    221224        main.unicodeConverter.charset="UTF-8";
    222         if (!main.adapt_genericSendMessage()) { MyLog.debug("\n## v_identity: init failed.\n"); return; }
     225        if (!main.adapt_genericSendMessage()) { Log.debug("\n## v_identity: init failed.\n"); return; }
    223226       
    224227        main.adapt_interface();
     
    235238       
    236239        main.initSystemStage1();
    237         MyLog.debug("## v_identity: init done.\n\n")
     240        Log.debug("## v_identity: init done.\n\n")
    238241    },
    239242   
    240243    initSystemStage1 : function() {
    241         MyLog.debug("## v_identity: initSystemStage1.\n")
     244        Log.debug("## v_identity: initSystemStage1.\n")
    242245        main.gMsgCompose = gMsgCompose;
    243246        document.getElementById("msgIdentity_clone").init();
    244247        vI.statusmenu.init();
    245         MyLog.debug("## v_identity: initSystemStage1 done.\n")
     248        Log.debug("## v_identity: initSystemStage1 done.\n")
    246249    },
    247250   
    248251    initSystemStage2 : function() {
    249         MyLog.debug("## v_identity: initSystemStage2.\n")
     252        Log.debug("## v_identity: initSystemStage2.\n")
    250253        vI.msgIdentityCloneTools.initReplyTo();
    251254        vI.storage.init();
    252255        vI.smartIdentity.init();
    253         MyLog.debug("## v_identity: initSystemStage2 done.\n")
     256        Log.debug("## v_identity: initSystemStage2 done.\n")
    254257    },
    255258   
     
    287290    adapt_genericSendMessage : function() {
    288291        if (main.original_functions.GenericSendMessage) return true; // only initialize this once
    289         MyLog.debug("## v_identity: adapt GenericSendMessage\n");
     292        Log.debug("## v_identity: adapt GenericSendMessage\n");
    290293        main.original_functions.GenericSendMessage = GenericSendMessage;
    291294        GenericSendMessage = main.replacement_functions.GenericSendMessage;
     
    296299        clearNote();
    297300        clearDebugOutput();
    298         MyLog.debug("## v_identity: composeDialog reopened. (msgType " + gMsgCompose.type + ")\n")
     301        Log.debug("## v_identity: composeDialog reopened. (msgType " + gMsgCompose.type + ")\n")
    299302       
    300303        // clean all elements
    301304        document.getElementById("msgIdentity_clone").clean();
    302         MyLog.debug("## v_identity: everything cleaned.\n")
     305        Log.debug("## v_identity: everything cleaned.\n")
    303306       
    304307        // now (re)init the elements
     
    327330                gMsgCompose.RegisterStateListener(main.ComposeStateListener);
    328331        }
    329         MyLog.debug("## v_identity: reopen done.\n")
     332        Log.debug("## v_identity: reopen done.\n")
    330333    },
    331334   
     
    384387        observe : function(subject, topic, data) {
    385388            if (topic == "am-smtpChanges") {
    386                 MyLog.debug("## v_identity: smtp changes observed\n");
     389                Log.debug("## v_identity: smtp changes observed\n");
    387390                var msgIdentity_clone = document.getElementById("msgIdentity_clone");
    388391                document.getAnonymousElementByAttribute(msgIdentity_clone, "class", "smtpServerListHbox").refresh();
    389392            }
    390393            if (topic == "am-acceptChanges") {
    391                 MyLog.debug("## v_identity: account changes observed\n");
     394                Log.debug("## v_identity: account changes observed\n");
    392395                document.getElementById("msgIdentity_clone").clean();
    393396                document.getElementById("msgIdentity_clone").init();
  • modules/vI_log.js

    r021dbf rc0a8de  
    2424
    2525var EXPORTED_SYMBOLS = ["setupLogging", "dumpCallStack", "MyLog", "Colors",
    26   "clearDebugOutput", "clearNote", "setNote", "addNote"]
     26  "clearDebugOutput", "clearNote",
     27  "SmartReplyNotification", "StorageNotification", "GetHeaderNotification" ]
    2728
    2829const {classes: Cc, interfaces: Ci, utils: Cu, results : Cr} = Components;
     
    3334  .getBranch("extensions.virtualIdentity.");
    3435
    35 
    36 function setupLogging(name) {
    37   let Log = Log4Moz.repository.getLogger(name);
    38   return Log;
    39 }
     36// different formatters for the log output
     37// Basic formatter that only prints the message / used for NotificationBox
     38function NotificationFormatter() {}
     39NotificationFormatter.prototype = {
     40  __proto__: Log4Moz.Formatter.prototype,
     41  format: function NF_format(message) {
     42    // The trick below prevents errors further down because mo is null or
     43    //  undefined.
     44    let messageString = [
     45      ("" + mo) for each
     46      ([,mo] in Iterator(message.messageObjects))].join(" ");
     47    return messageString;
     48  }
     49};
     50// Basic formatter that doesn't do anything fancy but does not add a newline
     51function BasicFormatter() {}
     52BasicFormatter.prototype = {
     53  __proto__: Log4Moz.Formatter.prototype,
     54  dateFormat : "%Y-%m-%d %H:%M:%S",
     55  format: function BF_format(message) {
     56    let date = new Date(message.time);
     57    // The trick below prevents errors further down because mo is null or
     58    //  undefined.
     59    let messageString = [
     60      ("" + mo) for each
     61      ([,mo] in Iterator(message.messageObjects))].join(" ");
     62    return date.toLocaleFormat(this.dateFormat) + "\t" +
     63      message.loggerName + "\t" + message.levelDesc + "\t" +
     64      messageString;
     65  }
     66};
     67// New formatter that only display's the source and message
     68function NewFormatter() {}
     69NewFormatter.prototype = {
     70  __proto__: Log4Moz.Formatter.prototype,
     71
     72  format: function NF_format(message) {
     73    // The trick below prevents errors further down because mo is null or
     74    //  undefined.
     75    let messageString = [
     76      ("" + mo) for each
     77      ([,mo] in Iterator(message.messageObjects))].join(" ");
     78    return message.loggerName.replace("virtualIdentity.", "") + ":\t" + messageString;
     79  }
     80};
     81
    4082/*
    41  * DumpAppender
     83 * DebugOutputAppender
    4284 * Logs to DebugOutput
    4385 */
    44 
    45 
    4686function DebugOutputAppender(formatter) {
    4787  this._name = "DebugOutputAppender";
     
    60100}
    61101
     102/*
     103 * NotificationOutputAppender
     104 * Logs to NotificationBox
     105 */
     106function NotificationOutputAppender(formatter) {
     107  this._name = "NotificationOutputAppender";
     108  Log4Moz.Appender.call(this, formatter);
     109}
     110NotificationOutputAppender.prototype = {
     111  __proto__: Log4Moz.Appender.prototype,
     112 
     113  currentWindow : null,
     114
     115  doAppend: function DOApp_doAppend(message) {
     116    this.currentWindow = Cc["@mozilla.org/appshell/window-mediator;1"]
     117      .getService(Ci.nsIWindowMediator)
     118      .getMostRecentWindow(null);
     119    this.addNote(message);
     120  },
     121 
     122  timer : null,
     123
     124  clearNote: function(self) {
     125    if (self.timer)
     126      self.currentWindow.clearTimeout(self.timer);
     127    self.timer = null;
     128    obj_notificationBox = self.currentWindow.document.getElementById("vINotification");
     129    if (!obj_notificationBox)
     130      return;
     131    obj_notificationBox.removeAllNotifications(true);
     132  },
     133
     134  setNote: function(note) {
     135    this.clearNote(this);
     136    this.addNote(note);
     137  },
     138
     139  addNote: function(note) {
     140    obj_notificationBox = this.currentWindow.document.getElementById("vINotification");
     141    if (!obj_notificationBox)
     142      return;
     143    var oldNotification = obj_notificationBox.currentNotification
     144    var newLabel = (oldNotification)?oldNotification.label + note:note;
     145    this.clearNote(this);
     146    obj_notificationBox.appendNotification(newLabel, "", "chrome://messenger/skin/icons/flag.png");
     147
     148    if (preferences.getIntPref("notification_timeout") != 0)
     149      this.timer =
     150        this.currentWindow.setTimeout(this.clearNote,
     151                                      preferences.getIntPref("notification_timeout") * 1000, this);
     152  }
     153}
     154
     155
     156function setupLogging(name) {
     157  let Log = Log4Moz.repository.getLogger(name);
     158  return Log;
     159}
     160
    62161
    63162function setupFullLogging(name) {
    64   let formatter = new Log4Moz.BasicFormatter();
     163  let myBasicFormatter = new BasicFormatter();
     164  let myNewFormatter = new NewFormatter();
    65165  let Log = Log4Moz.repository.getLogger(name);
    66166
     
    71171  if (preferences.getBoolPref("debug_notification")) {
    72172    // A console appender outputs to the JS Error Console
    73     let capp = new Log4Moz.ConsoleAppender(formatter);
     173    let capp = new Log4Moz.ConsoleAppender(myBasicFormatter);
    74174    capp.level = Log4Moz.Level["Warn"];
    75175    root.addAppender(capp);
    76176
    77177    // A dump appender outputs to standard out
    78     let dapp = new Log4Moz.DumpAppender(formatter);
     178    let dapp = new Log4Moz.DumpAppender(myBasicFormatter);
    79179    dapp.level = Log4Moz.Level["All"];
    80180    root.addAppender(dapp);
    81181
    82182    // A dump appender outputs to Debug Output Box
    83     let doapp = new DebugOutputAppender(formatter);
     183    let doapp = new DebugOutputAppender(myNewFormatter);
    84184    doapp.level = Log4Moz.Level["All"];
    85185    root.addAppender(doapp);
    86 
    87   }
    88 
    89   Log.debug("Logging enabled");
    90 
     186  }
    91187  return Log;
    92188}
    93 
    94 // Must call this once to setup the root logger
    95 let logRoot = "virtualIdentity";
    96 let MyLog = setupFullLogging(logRoot);
    97189
    98190function dumpCallStack(e) {
     
    113205
    114206function clearDebugOutput() {
    115     window = Cc["@mozilla.org/appshell/window-mediator;1"]
    116       .getService(Ci.nsIWindowMediator)
    117       .getMostRecentWindow(null);
    118     obj_debugBox = window.document.getElementById("vIDebugBox");
    119     if (obj_debugBox) obj_debugBox.clear();
    120 }
    121 
    122 timer = null;
     207  currentWindow = Cc["@mozilla.org/appshell/window-mediator;1"]
     208    .getService(Ci.nsIWindowMediator)
     209    .getMostRecentWindow(null);
     210  obj_debugBox = currentWindow.document.getElementById("vIDebugBox");
     211  if (obj_debugBox)
     212    obj_debugBox.clear();
     213}
    123214
    124215function clearNote() {
    125     if (timer) window.clearTimeout(timer);
    126     timer = null;
    127     document.getElementById("vINotification").removeAllNotifications(true);
    128 }
    129 
    130 function setNote(note, prefstring) {
    131   clearNote();
    132   addNote(note, prefstring);
    133 };
    134 
    135 //  overflow : function(elem) {
    136 //      // height will be cut off from messagepane (in 3pane window)
    137 //      var objMessagepane = document.getElementById("messagepane");
    138 //      var maxHeight = (objMessagepane)?parseInt(objMessagepane.boxObject.height / 2)+1:null;
    139 //      if (maxHeight < 60) maxHeight = 60; // set a minimum size, if to small scrollbars are hidden
    140 //      var tooBig = (maxHeight)?(elem.inputField.scrollHeight > maxHeight):false;
    141 //      var newHeight = (tooBig)?maxHeight:elem.inputField.scrollHeight;
    142 //      elem.height = newHeight;
    143 //      // give the box a frame if it is to big
    144 //      if (tooBig) document.getElementById("vINotificationTextbox").setAttribute("class", "plain border")
    145 //  },
    146 
    147 function addNote(note, prefstring) {
    148     if (!preferences.getBoolPref(prefstring)) return;
    149     Log.debug("addNote: ", note);
    150    
    151     var oldNotification = document.getElementById("vINotification").currentNotification
    152     var newLabel = (oldNotification)?oldNotification.label + note:note;
    153     clearNote();
    154     document.getElementById("vINotification")
    155             .appendNotification(newLabel, "", "chrome://messenger/skin/icons/flag.png");
    156 
    157     if (preferences.getIntPref("notification_timeout") != 0)
    158         timer = window.setTimeout(virtualIdentityExtension.clearNote,
    159             preferences.getIntPref("notification_timeout") * 1000);
    160 }
     216  currentWindow = Cc["@mozilla.org/appshell/window-mediator;1"]
     217    .getService(Ci.nsIWindowMediator)
     218    .getMostRecentWindow(null);
     219  obj_notificationBox = currentWindow.document.getElementById("vINotification");
     220  if (!obj_notificationBox)
     221    return;
     222  obj_notificationBox.removeAllNotifications(true);
     223}
     224
     225let logRoot = "virtualIdentity";
     226let MyLog = setupFullLogging(logRoot);
     227
     228let myNotificationFormatter = new NotificationFormatter();
     229let SmartReplyNotification = Log4Moz.repository.getLogger("virtualIdentity.SmartReply");
     230if (preferences.getBoolPref("smart_reply_notification")) {
     231  let napp = new NotificationOutputAppender(myNotificationFormatter);
     232  napp.level = Log4Moz.Level["All"];
     233  SmartReplyNotification.addAppender(napp);
     234}
     235let StorageNotification = Log4Moz.repository.getLogger("virtualIdentity.StorageNotification");
     236if (preferences.getBoolPref("storage_notification")) {
     237  let napp = new NotificationOutputAppender(myNotificationFormatter);
     238  napp.level = Log4Moz.Level["All"];
     239  StorageNotification.addAppender(napp);
     240}
     241let GetHeaderNotification = Log4Moz.repository.getLogger("virtualIdentity.GetHeaderNotification");
     242if (preferences.getBoolPref("get_header_notification")) {
     243  let napp = new NotificationOutputAppender(myNotificationFormatter);
     244  napp.level = Log4Moz.Level["All"];
     245  GetHeaderNotification.addAppender(napp);
     246}
Note: See TracChangeset for help on using the changeset viewer.