Changeset 9cedc0 for chrome/content/v_identity/v_identity.js
- Timestamp:
- Sep 25, 2011, 9:23:06 PM (11 years ago)
- Branches:
- ng_0.9
- Children:
- 284956
- Parents:
- 7666cb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
chrome/content/v_identity/v_identity.js
r7666cb r9cedc0 34 34 unicodeConverter : Components.classes["@mozilla.org/intl/scriptableunicodeconverter"] 35 35 .createInstance(Components.interfaces.nsIScriptableUnicodeConverter), 36 37 accountManager : Components.classes["@mozilla.org/messenger/account-manager;1"] 38 .getService(Components.interfaces.nsIMsgAccountManager), 39 36 40 37 41 gMsgCompose : null, // to store the global gMsgCompose after MsgComposeDialog is closed … … 80 84 FillIdentityList: function(menulist) { 81 85 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, 85 87 Components.interfaces.nsIMsgAccount); 86 88 … … 88 90 accounts = accounts.filter(function isNonSuckyAccount(a) { return !!a.incomingServer; }); 89 91 function sortAccounts(a, b) { 90 if (a.key == m gr.defaultAccount.key)92 if (a.key == main.accountManager.defaultAccount.key) 91 93 return -1; 92 if (b.key == m gr.defaultAccount.key)94 if (b.key == main.accountManager.defaultAccount.key) 93 95 return 1; 94 96 var aIsNews = a.incomingServer.type == "nntp"; … … 133 135 vI.storage.awOnBlur(vI.storage.focusedElement); 134 136 135 var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]136 .getService(Components.interfaces.nsIPromptService);137 137 vI.notificationBar.dump("\n## v_identity: VIdentity_GenericSendMessage\n"); 138 138 139 if (msgType == Components.interfaces.nsIMsgCompDeliverMode.Now) { vI.msgIdentityCloneTools.addReplyToSelf(); } 140 139 141 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); 148 155 main.replacement_functions.GenericSendMessageInProgress = false; 156 vI.notificationBar.dump("## sending: -------------- aborted ---------------------------------\n") 149 157 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(); 159 168 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"); 186 170 }, 187 171 … … 199 183 main.Cleanup(); 200 184 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 201 212 }, 202 213 … … 231 242 document.getElementById("msgIdentity_clone").init(); 232 243 vI.statusmenu.init(); 244 vI.notificationBar.dump("## v_identity: initSystemStage1 done.\n") 233 245 }, 234 246 … … 238 250 vI.storage.init(); 239 251 vI.smartIdentity.init(); 252 vI.notificationBar.dump("## v_identity: initSystemStage2 done.\n") 240 253 }, 241 254 … … 286 299 // clean all elements 287 300 document.getElementById("msgIdentity_clone").clean(); 288 vI.smartIdentity.clean();289 301 vI.notificationBar.dump("## v_identity: everything cleaned.\n") 290 302 … … 356 368 prepareAccount : function() { 357 369 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)); 359 372 main.addVirtualIdentityToMsgIdentityMenu(); 360 373 },
Note: See TracChangeset
for help on using the changeset viewer.