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

Ignore:
Timestamp:
Sep 25, 2011, 9:23:06 PM (11 years ago)
Author:
rene <rene@…>
Branches:
ng_0.9
Children:
284956
Parents:
7666cb
Message:

compatibility for conversation plugin

File:
1 edited

Legend:

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

    r7666cb r9cedc0  
    3434    unicodeConverter : Components.classes["@mozilla.org/intl/scriptableunicodeconverter"]
    3535                .createInstance(Components.interfaces.nsIScriptableUnicodeConverter),
     36                           
     37    accountManager : Components.classes["@mozilla.org/messenger/account-manager;1"]
     38            .getService(Components.interfaces.nsIMsgAccountManager),
     39       
    3640
    3741    gMsgCompose : null, // to store the global gMsgCompose after MsgComposeDialog is closed
     
    8084        FillIdentityList: function(menulist) {
    8185            vI.notificationBar.dump("## v_identity: mod. FillIdentityList\n");
    82             var mgr = Components.classes["@mozilla.org/messenger/account-manager;1"]
    83                                 .getService(Components.interfaces.nsIMsgAccountManager);
    84             var accounts = queryISupportsArray(mgr.accounts,
     86            var accounts = queryISupportsArray(main.accountManager.accounts,
    8587                                     Components.interfaces.nsIMsgAccount);
    8688
     
    8890            accounts = accounts.filter(function isNonSuckyAccount(a) { return !!a.incomingServer; });
    8991            function sortAccounts(a, b) {
    90                 if (a.key == mgr.defaultAccount.key)
     92                if (a.key == main.accountManager.defaultAccount.key)
    9193                return -1;
    92                 if (b.key == mgr.defaultAccount.key)
     94                if (b.key == main.accountManager.defaultAccount.key)
    9395                return 1;
    9496                var aIsNews = a.incomingServer.type == "nntp";
     
    133135            vI.storage.awOnBlur(vI.storage.focusedElement);
    134136
    135             var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
    136                 .getService(Components.interfaces.nsIPromptService);
    137137            vI.notificationBar.dump("\n## v_identity: VIdentity_GenericSendMessage\n");
    138138           
     139            if (msgType == Components.interfaces.nsIMsgCompDeliverMode.Now) { vI.msgIdentityCloneTools.addReplyToSelf(); }
     140
    139141            var vid = document.getElementById("msgIdentity_clone").vid
    140 
    141             if (msgType == nsIMsgCompDeliverMode.Now) {
    142                 if ( (vid && main.preferences.getBoolPref("warn_virtual") &&
    143                     !(promptService.confirm(window,"Warning",
    144                         main.elements.strings.getString("vident.sendVirtual.warning")))) ||
    145                   (!vid && main.preferences.getBoolPref("warn_nonvirtual") &&
    146                     !(promptService.confirm(window,"Warning",
    147                         main.elements.strings.getString("vident.sendNonvirtual.warning")))) ) {
     142            var virtualIdentityData = document.getElementById("msgIdentity_clone").identityData;
     143           
     144            returnValue = vI.prepareSendMsg(    vid, msgType, virtualIdentityData,
     145                            main.accountManager.getIdentity(main.elements.Obj_MsgIdentity.value),
     146                            main._getRecipients() );
     147            if (returnValue.update == "abort") {
     148                main.replacement_functions.GenericSendMessageInProgress = false;
     149                vI.notificationBar.dump("## sending: --------------  aborted  ---------------------------------\n")
     150                return;
     151            }
     152            else if (returnValue.update == "takeover") {
     153                    var msgIdentityCloneElem = document.getElementById("msgIdentity_clone");
     154                    msgIdentityCloneElem.selectedMenuItem = msgIdentityCloneElem.addIdentityToCloneMenu(returnValue.storedIdentity);
    148155                    main.replacement_functions.GenericSendMessageInProgress = false;
     156                    vI.notificationBar.dump("## sending: --------------  aborted  ---------------------------------\n")
    149157                    return;
    150                 }
    151                 if (!vI.storage.storeVIdentityToAllRecipients(msgType)) {
    152 //                  vI.notificationBar.dump("## v_identity: sending aborted\n");
    153                     main.replacement_functions.GenericSendMessageInProgress = false;
    154                     return;
    155                 }
    156                 vI.msgIdentityCloneTools.addReplyToSelf();
    157             }
    158             if (vid) main.prepareAccount();
     158            }
     159           
     160            if (vid) main.addVirtualIdentityToMsgIdentityMenu();
     161           
     162            // final check if eyerything is nice before we handover to the real sending...
     163            if (vI.finalCheck(virtualIdentityData, getCurrentIdentity())) {
     164                main.replacement_functions.GenericSendMessageInProgress = false;
     165                main.original_functions.GenericSendMessage(msgType);
     166            }
     167            else    main.Cleanup();
    159168            main.replacement_functions.GenericSendMessageInProgress = false;
    160 //          vI.notificationBar.dump("## v_identity: original_functions.GenericSendMessage\n");
    161 
    162             // final check if eyerything is nice before we handover to the real sending...
    163             var virtualIdentityData = document.getElementById("msgIdentity_clone").identityData;
    164 
    165             var currentIdentity = getCurrentIdentity();
    166             //                          vI.identityData(email, fullName, id, smtp, extras, sideDescription, existingID)
    167             var currentIdentityData = new vI.identityData(currentIdentity.email, currentIdentity.fullName, null, currentIdentity.smtpServerKey, null, null, null);
    168            
    169             vI.notificationBar.dump("\n## vI.identityData GenericSendMessage Final Check\n");
    170             vI.notificationBar.dump("## vI.identityData currentIdentity: fullName='" + currentIdentityData.fullName + "' email='" + currentIdentityData.email + "' smtp='" + currentIdentityData.smtp.key + "'\n");
    171             vI.notificationBar.dump("## vI.identityData virtualIdentityData: fullName='" + virtualIdentityData.fullName + "' email='" + virtualIdentityData.email + "' smtp='" + virtualIdentityData.smtp.key + "'\n");
    172 
    173             if  (currentIdentityData.fullName.toLowerCase() == virtualIdentityData.fullName.toLowerCase()   &&
    174                 currentIdentityData.email.toLowerCase() == virtualIdentityData.email.toLowerCase()      &&
    175                 virtualIdentityData.smtp.equal(currentIdentityData.smtp)    ) {
    176                     main.original_functions.GenericSendMessage(msgType);
    177             }
    178             else {
    179                 if (!(currentIdentityData.fullName.toLowerCase() == virtualIdentityData.fullName.toLowerCase())) vI.notificationBar.dump("\n## vI.identityData failed check for fullName.\n");
    180                 if (!(currentIdentityData.email.toLowerCase() == virtualIdentityData.email.toLowerCase())) vI.notificationBar.dump("\n## vI.identityData failed check for email.\n");
    181                 if (!(virtualIdentityData.smtp.equal(currentIdentityData.smtp))) vI.notificationBar.dump("\n## vI.identityData failed check for SMTP.\n");
    182                 alert(main.elements.strings.getString("vident.genericSendMessage.error"));
    183                 main.Cleanup();
    184             }
    185 //          vI.notificationBar.dump("## v_identity: original_functions.GenericSendMessage done\n");
     169            //          vI.notificationBar.dump("## v_identity: original_functions.GenericSendMessage done\n");
    186170        },
    187171       
     
    199183        main.Cleanup();
    200184        vI.storage.clean();
     185    },
     186
     187    _getRecipients : function(row) {
     188        var recipients = [];
     189        for (var row = 1; row <= top.MAX_RECIPIENTS; row ++) {
     190            var recipientType = awGetPopupElement(row).selectedItem.getAttribute("value");
     191            if (recipientType == "addr_reply" || recipientType == "addr_followup" ||
     192                main._recipientIsDoBcc(row) || awGetInputElement(row).value.match(/^\s*$/) ) continue;
     193            recipients.push( { recipient: awGetInputElement(row).value, recipientType : recipientType } );
     194        }
     195        return recipients;
     196    },
     197   
     198    _recipientIsDoBcc : function(row) {
     199        var recipientType = awGetPopupElement(row).selectedItem.getAttribute("value");
     200        if (recipientType != "addr_bcc" || !getCurrentIdentity().doBcc) return false
     201
     202        var doBccArray = gMsgCompose.compFields.splitRecipients(getCurrentIdentity().doBccList, false, {});
     203
     204        for (var index = 0; index < doBccArray.count; index++ ) {
     205            if (doBccArray.StringAt(index) == awGetInputElement(row).value) {
     206                vI.notificationBar.dump("## main _recipientIsDoBcc: ignoring doBcc field '" +
     207                    doBccArray.StringAt(index) + "'.\n");
     208                return true;
     209            }
     210        }       
     211        return false
    201212    },
    202213
     
    231242        document.getElementById("msgIdentity_clone").init();
    232243        vI.statusmenu.init();
     244        vI.notificationBar.dump("## v_identity: initSystemStage1 done.\n")
    233245    },
    234246   
     
    238250        vI.storage.init();
    239251        vI.smartIdentity.init();
     252        vI.notificationBar.dump("## v_identity: initSystemStage2 done.\n")
    240253    },
    241254   
     
    286299        // clean all elements
    287300        document.getElementById("msgIdentity_clone").clean();
    288         vI.smartIdentity.clean();
    289301        vI.notificationBar.dump("## v_identity: everything cleaned.\n")
    290302       
     
    356368    prepareAccount : function() {
    357369        main.Cleanup(); // just to be sure that nothing is left (maybe last time sending was irregularily stopped)
    358         vI.account.createAccount();
     370        vI.account.createAccount(document.getElementById("msgIdentity_clone").identityData,
     371                                 main.accountManager.getIdentity(main.elements.Obj_MsgIdentity.value));
    359372        main.addVirtualIdentityToMsgIdentityMenu();
    360373    },
Note: See TracChangeset for help on using the changeset viewer.