Changeset 85fa10
- Timestamp:
- Sep 9, 2018, 2:36:02 AM (4 years ago)
- Branches:
- ng_0.9
- Children:
- c5860f
- Parents:
- bc6c6b
- Files:
-
- 2 deleted
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
chrome.manifest
rbc6c6b r85fa10 31 31 32 32 33 overlay chrome://messenger/content/am-smtp.xul chrome://v_identity/content/accountManagerOverlays/vI_am-smtpOverlay.xul34 33 overlay chrome://messenger/content/AccountManager.xul chrome://v_identity/content/accountManagerOverlays/vI_am-Overlay.xul -
content/bindings/vI_rdfAccountMismatchDialog.xml
rbc6c6b r85fa10 74 74 <implementation> 75 75 <constructor> 76 <![CDATA[ 76 <![CDATA[ 77 77 var menuitem = document.createElement("menuitem"); 78 78 menuitem.setAttribute("class", "mismatchMenuitem"); … … 95 95 if (oldval) { 96 96 oldval.removeAttribute('selected'); 97 if ( document instanceof Components.interfaces.nsIDOMXULDocument) {97 if (ChromeUtils.getClassName(document) == "XULDocument") { 98 98 document.removeBroadcastListenerFor(oldval, this, "value"); 99 99 document.removeBroadcastListenerFor(oldval, this, "label"); … … 116 116 // DOMAttrModified listeners slow down setAttribute calls within 117 117 // the document, see bug 395496 118 if ( document instanceof Components.interfaces.nsIDOMXULDocument) {118 if (ChromeUtils.getClassName(document) == "XULDocument") { 119 119 document.addBroadcastListenerFor(val, this, "value"); 120 120 document.addBroadcastListenerFor(val, this, "label"); … … 156 156 <body><![CDATA[ 157 157 virtualIdentityExtension.Log.debug("rdfAccountMismatchDialog.xml mismatchID-menupopup: _addIdentities."); 158 Components.utils.import("resource://v_identity/vI_accountUtils.js", virtualIdentityExtension); 158 159 var accounts = virtualIdentityExtension.getAccountsArray(); 159 160 for (let acc = 0; acc < accounts.length; acc++) { … … 174 175 ]]></body> 175 176 </method> 176 <method name="_addSmtp"> 177 <parameter name="server" /> 177 <method name="_addIdentitiesWithSmtp"> 178 178 <body><![CDATA[ 179 virtualIdentityExtension.Log.debug("rdfAccountMismatchDialog.xml mismatchID-menupopup: _addSmtp."); 180 const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; 181 var menuitem = document.createElementNS(XUL_NS, "menuitem"); // create a new XUL menuitem 182 menuitem.setAttribute("class", "mismatchMenuitem"); 183 menuitem.setAttribute("label", (server.description?server.description:server.hostname)); 184 menuitem.setAttribute("ext1", server.hostname); 185 menuitem.setAttribute("ext2", server.username); 186 menuitem.setAttribute("key", server.key); 187 this.appendChild(menuitem); 179 virtualIdentityExtension.Log.debug("rdfAccountMismatchDialog.xml mismatchID-menupopup: _addIdentitiesWithSmtp."); 180 Components.utils.import("resource://v_identity/vI_accountUtils.js", virtualIdentityExtension); 181 var accounts = virtualIdentityExtension.getAccountsArray(); 182 for (let acc = 0; acc < accounts.length; acc++) { 183 let account = accounts[acc]; 184 let identities = virtualIdentityExtension.getIdentitiesArray(account); 185 for (let i = 0; i < identities.length; i++) { 186 let identity = identities[i]; 187 const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; 188 var menuitem = document.createElementNS(XUL_NS, "menuitem"); // create a new XUL menuitem 189 menuitem.setAttribute("class", "mismatchMenuitem"); 190 menuitem.setAttribute("label", identity.identityName); 191 192 ChromeUtils.import("resource:///modules/mailServices.js"); 193 var servers = MailServices.smtp.servers; 194 195 var smtpName; 196 while (servers && servers.hasMoreElements()) { 197 var server = servers.getNext(); 198 if (server instanceof Components.interfaces.nsISmtpServer && 199 !server.redirectorType && identity.smtpServerKey == server.key) { 200 smtpName = server.description ? server.description : server.hostname; 201 break; 202 } 203 } 204 205 menuitem.setAttribute("ext1", smtpName); 206 menuitem.setAttribute("key", identity.key); 207 this.appendChild(menuitem); 208 } 209 } 210 virtualIdentityExtension.Log.debug("rdfAccountMismatchDialog.xml mismatchID-menupopup: _addIdentitiesWithSmtp done."); 188 211 ]]></body> 189 </method>190 <method name="_addSmtpServers">191 <body><![CDATA[192 virtualIdentityExtension.Log.debug("rdfAccountMismatchDialog.xml mismatchID-menupopup: _addSmtpServers.");193 194 const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";195 var menuitem = document.createElementNS(XUL_NS, "menuitem"); // create a new XUL menuitem196 menuitem.setAttribute("class", "mismatchMenuitem");197 menuitem.setAttribute("key", virtualIdentityExtension.identityData.DEFAULT_SMTP_TAG);198 199 menuitem.setAttribute("label", Components.classes["@mozilla.org/intl/stringbundle;1"]200 .getService(Components.interfaces.nsIStringBundleService)201 .createBundle("chrome://v_identity/locale/v_identity.properties")202 .GetStringFromName("defaultServerTag"));203 204 this.appendChild(menuitem);205 206 var servers, smtpService = Components.classes["@mozilla.org/messengercompose/smtp;1"]207 .getService(Components.interfaces.nsISmtpService);208 // check for new https://hg.mozilla.org/comm-central/rev/fab9e5145cd4 smtpService209 if (typeof(smtpService.servers) == "object") servers = smtpService.servers;210 else servers = smtpService.smtpServers;211 212 while (servers && servers.hasMoreElements()) {213 var server = servers.getNext();214 if (server instanceof Components.interfaces.nsISmtpServer && !server.redirectorType) this._addSmtp(server);215 }216 ]]></body>217 212 </method> 218 213 <constructor> … … 221 216 const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; 222 217 this.appendChild(document.createElementNS(XUL_NS, "menuseparator")); // create a new XUL menuseparator 223 if (this.getAttribute("type") == "identity") this._addIdentities(); 224 else this._addSmtpServers(); 225 ]]> 218 switch (this.getAttribute("type")) { 219 case "identity": 220 this._addIdentities(); 221 break; 222 case "smtpid": 223 this._addIdentitiesWithSmtp(); 224 break; 225 } 226 ]]> 226 227 </constructor> 227 228 </implementation> -
content/bindings/v_identity.xml
rbc6c6b r85fa10 83 83 "<td class='image'><img src='chrome://v_identity/skin/vi-info.png' /></td>" + 84 84 "<td class='identityTable'>" + 85 "<div class='name'>" + this.elem.identityData.combinedNameHtml + "</div>" + 86 85 "<div class='name'>" + this.elem.identityData.combinedNameHtml + "</div>" + 86 "<table><tbody>" + this.elem.identityData.getMatrix() + "</tbody></table>" + 87 87 "</td>" + 88 88 "</tr></table>" … … 135 135 136 136 this.description = this._identityDataStorage.sideDescription?this._identityDataStorage.sideDescription:""; 137 this.smtp = this._identityDataStorage.smtp.value; 137 this.smtp = this._identityDataStorage.id.smtpServerName; 138 138 139 // virtualIdentityExtension.MyLog.debug("v_identity.xml fromPopupItem_clone constructor smtp='" + this.smtp + "'") 139 140 this.smtpStyle = "width:" + document.getElementById("virtualIdentityExtension_SmtpServerList").clientWidth + "px;"; 140 this._identityDataStorage.smtp.value;141 141 142 142 document.getElementById("virtualIdentityExtension_tooltipPopupset").addTooltip(this, true); … … 164 164 </implementation> 165 165 </binding> 166 167 <binding id="smtpServerList">168 <resources>169 <stylesheet src="chrome://global/skin/menu.css"/>170 </resources>171 <content sizetopopup="pref">172 <xul:hbox id="smtpServerHbox" class="smtpServerHbox">173 <xul:menulist class="smtpServerMenuList" anonid="smtpServerMenuList" allowevents="true" id="virtualIdentityExtension_SmtpServerList">174 <xul:menupopup anonid="virtualIdentityExtension_SmtpServerList_popup" />175 </xul:menulist>176 <xul:checkbox id="virtualIdentityExtension_SaveSmtpSwitch" class="vI_plain" allowevents="true" oncommand="event.stopPropagation();virtualIdentityExtension.vIprefs.set('storage_store_SMTP', this.checked);" >177 <xul:observes element="virtualIdentityExtension_statusMenu_storage_saveSMTP" attribute="checked" />178 <xul:observes element="virtualIdentityExtension_statusMenu_storage_saveSMTP" attribute="disabled" />179 </xul:checkbox>180 <xul:observes element="virtualIdentityExtension_statusMenu_storage_saveSMTP" attribute="checked" />181 <xul:observes element="virtualIdentityExtension_statusMenu_storage_saveSMTP" attribute="disabled" />182 </xul:hbox>183 </content>184 <implementation>185 <method name="addNoneServer">186 <body><![CDATA[187 var listitem = document.createElement("menuitem");188 listitem.setAttribute("class", "menuitem-non-iconic");189 listitem.setAttribute("type", "non-iconic-noaccel");190 listitem.setAttribute("label", " ");191 listitem.setAttribute("key", virtualIdentityExtension.NO_SMTP_TAG);192 this._smtpPopup.insertBefore(listitem, this._smtpPopup.firstChild);193 this._smtpMenu.selectedItem = listitem;194 ]]></body>195 </method>196 <method name="_addDefaultServer">197 <body><![CDATA[198 var listitem = document.createElement("menuitem");199 listitem.setAttribute("class", "menuitem-non-iconic");200 listitem.setAttribute("type", "non-iconic-noaccel");201 listitem.setAttribute("label",202 Components.classes["@mozilla.org/intl/stringbundle;1"]203 .getService(Components.interfaces.nsIStringBundleService)204 .createBundle("chrome://messenger/locale/messenger.properties")205 .GetStringFromName("defaultServerTag"));206 this._smtpPopup.appendChild(listitem);207 this._smtpMenu.selectedItem = listitem;208 ]]></body>209 </method>210 <method name="_addServer">211 <parameter name="server" />212 <body><![CDATA[213 if (server instanceof Components.interfaces.nsISmtpServer && !server.redirectorType) {214 var listitem = document.createElement("menuitem");215 listitem.setAttribute("class", "menuitem-non-iconic");216 listitem.setAttribute("type", "non-iconic-noaccel");217 listitem.setAttribute("label", (server.description?server.description:server.hostname));218 listitem.setAttribute("key", server.key);219 this._smtpPopup.appendChild(listitem);220 }221 ]]></body>222 </method>223 <method name="refresh">224 <body><![CDATA[225 this.unload();226 this.load();227 ]]></body>228 </method>229 <method name="load">230 <body><![CDATA[231 this._addDefaultServer();232 this._smtpPopup.appendChild(document.createElement("menuseparator"));233 234 var servers, smtpService = Components.classes["@mozilla.org/messengercompose/smtp;1"]235 .getService(Components.interfaces.nsISmtpService);236 // check for new https://hg.mozilla.org/comm-central/rev/fab9e5145cd4 smtpService237 if (typeof(smtpService.servers) == "object") servers = smtpService.servers;238 else servers = smtpService.smtpServers;239 240 while (servers && servers.hasMoreElements())241 this._addServer(servers.getNext());242 ]]></body>243 </method>244 <method name="unload">245 <body><![CDATA[246 var MenuItems = this._smtpPopup.childNodes247 while (MenuItems.length > 0) { this._smtpPopup.removeChild(MenuItems[0]) }248 this._smtpMenu.selectedItem = null;249 ]]></body>250 </method>251 <constructor>252 <![CDATA[253 this.load();254 ]]>255 </constructor>256 <property name="smtp" onget="return this._smtpMenu.selectedItem.getAttribute('key');" >257 <setter><![CDATA[258 if (val == virtualIdentityExtension.NO_SMTP_TAG) return; // dont overwrite if not set259 virtualIdentityExtension.MyLog.debug("v_identity.xml smtp set to '" + val + "'")260 var MenuItems = this._smtpPopup.childNodes261 for (var index = 0; index < MenuItems.length; index++) {262 if (MenuItems[index].localName == "menuseparator") continue;263 if (MenuItems[index].getAttribute("key") == val) {264 this._smtpMenu.selectedItem = MenuItems[index];265 break;266 }267 }268 ]]></setter>269 </property>270 <field name="_smtpPopup">document.getAnonymousElementByAttribute(this, "anonid", "virtualIdentityExtension_SmtpServerList_popup")</field>271 <field name="_smtpMenu">document.getAnonymousElementByAttribute(this, "anonid", "smtpServerMenuList")</field>272 <field name="_smtpService"></field>273 274 </implementation>275 </binding>276 277 166 278 167 <binding id="fromMenuList_new" extends="chrome://global/content/bindings/menulist.xml#menulist-editable"> … … 306 195 </xul:hbox> 307 196 </xul:moz-input-box> 308 <!--<xul:hbox oncommand="event.stopPropagation();document.getBindingParent(this).smtp = this.smtp" xbl:inherits="showSmtp" anonid="smtpServerListHbox" class="smtpServerListHbox" />-->309 197 <xul:dropmarker class="menulist-dropmarker" type="menu" xbl:inherits="open,disabled,parentfocused=focused"/> 310 198 <xul:popupset id="virtualIdentityExtension_tooltipPopupset" /> … … 324 212 // it will be done in v_identity.js init 325 213 // document.getElementById("virtualIdentityExtension_tooltipPopupset").addTooltip(this, false); 326 327 virtualIdentityExtension.vIprefs.addObserver("show_smtp", this.observe, this);328 this.observe(this);329 214 ]]> 330 215 </constructor> … … 333 218 var tooltipPopupset = document.getElementById("virtualIdentityExtension_tooltipPopupset") 334 219 if (tooltipPopupset) tooltipPopupset.removeTooltip(this.tooltipElem.getAttribute("tooltip")); 335 virtualIdentityExtension.vIprefs.removeObserver("show_smtp", this.observe);336 220 ]]> 337 221 </destructor> … … 438 322 ]]></body> 439 323 </method> 440 <property name="smtp" onget="return this.identityData.smtp.key;" > // used to detect changes from SMTP-Menu441 <setter><![CDATA[442 this.identityData.smtp.key = val;443 444 document.getElementById("virtualIdentityExtension_tooltipPopupset").addTooltip(this);445 446 var existingIdentity = this.checkForVirtualIdentity();447 if (existingIdentity) this.selectedMenuItem = existingIdentity;448 ]]></setter>449 </property>450 324 <property name="identityData"> 451 325 <getter><![CDATA[ … … 470 344 <field name="tooltipElem">document.getAnonymousElementByAttribute(this, "anonid", "inputBox")</field> 471 345 <field name="textBoxElem">document.getAnonymousElementByAttribute(this, "anonid", "input");</field> 472 <method name="observe">473 <parameter name="self" />474 <parameter name="aSubject" />475 <parameter name="aTopic" />476 <parameter name="aPrefName" />477 <body><![CDATA[478 self.showSmtp =479 virtualIdentityExtension.vIprefs.get("show_smtp");480 var MenuItems = self._popupElem.childNodes;481 for (var j = 0; j < MenuItems.length; j++) {482 if (MenuItems[j].localName == "menuseparator") continue;483 MenuItems[j].smtpStyle = "width:" + document.getElementById("virtualIdentityExtension_SmtpServerList").clientWidth + "px;";484 }485 ]]></body>486 </method>487 346 <property name="email" onset="this.identityData.email = val; this.label = this.identityData.combinedName; this.inputEvent()" /> 488 347 <property name="vid" onget="return (this.getAttribute('vid') == 'true');" onset="this.setAttribute('vid',val); return val;" /> … … 490 349 <property name="extras" onget="return this.identityData.extras;" /> 491 350 <property name="description" onget="return this.getAttribute('description');" onset="this.setAttribute('description', val); return val;" /> 492 <!--<property name="showSmtp" onget="return (this.getAttribute('showSmtp') == 'true');" onset="this.setAttribute('showSmtp',val?'true':'false'); return val;" />-->493 351 </implementation> 494 352 </binding> … … 522 380 this.identityData = new virtualIdentityExtension.identityData(window, identity.email, 523 381 identity.fullName, identity.key, 524 identity.smtpServerKey,null, null, true);382 null, null, true); 525 383 this._identityData.extras.readIdentityValues(identity); 526 384 } … … 550 408 this._setAttributeIfNotEmpty("label", this._identityData.combinedName); 551 409 this._setAttributeIfNotEmpty("value", this._identityData.combinedName); 552 this._setAttributeIfNotEmpty("smtp", this._identityData. smtp.value);410 this._setAttributeIfNotEmpty("smtp", this._identityData.id.smtpServerName); 553 411 this._setAttributeIfNotEmpty("description", ""); 554 412 -
content/prefDialog/vI_prefDialog.js
rbc6c6b r85fa10 131 131 "VIdent_identity.smart_reply_for_newsgroups", 132 132 "VIdent_identity.show_status", 133 "VIdent_identity.show_smtp",134 133 "VIdent_identity.fcc_show_switch", 135 134 "VIdent_identity.menu_entry", … … 157 156 "VIdent_identity.storage_store", 158 157 "VIdent_identity.storage_store_base_id", 159 "VIdent_identity.storage_store_SMTP",160 158 "VIdent_identity.storage_dont_update_multiple", 161 159 "VIdent_identity.storage_show_switch", 162 160 "VIdent_identity.storage_show_baseID_switch", 163 "VIdent_identity.storage_show_SMTP_switch",164 161 "VIdent_identity.storage_colorIndication", 165 162 "VIdent_identity.storage_warn_update", … … 324 321 mAttr("VIdent_identity.storage_store", "disabled", element.checked); 325 322 mAttr("VIdent_identity.storage_store_base_id", "disabled", element.checked); 326 mAttr("VIdent_identity.storage_store_SMTP", "disabled", element.checked);327 323 mAttr("VIdent_identity.storage_dont_update_multiple", "disabled", element.checked); 328 324 mAttr("VIdent_identity.storage_show_switch", "disabled", element.checked); 329 325 mAttr("VIdent_identity.storage_show_baseID_switch", "disabled", element.checked); 330 mAttr("VIdent_identity.storage_show_SMTP_switch", "disabled", element.checked);331 326 mAttr("VIdent_identity.storage_colorIndication", "disabled", element.checked); 332 327 mAttr("VIdent_identity.storage_warn_update", "disabled", element.checked); -
content/prefDialog/vI_prefDialog.xul
rbc6c6b r85fa10 363 363 <checkbox id="VIdent_identity.show_status" label="&vI_prefDialog.composeDialog.status.label;" 364 364 tooltiptext="&vI_prefDialog.composeDialog.status.tooltiptext;" prefstring="show_status" /> 365 <checkbox id="VIdent_identity.show_smtp" label="&vI_prefDialog.composeDialog.SMTP.label;"366 tooltiptext="&vI_prefDialog.composeDialog.SMTP.tooltiptext;" prefstring="show_smtp" />367 365 <checkbox id="VIdent_identity.fcc_show_switch" label="&vI_prefDialog.composeDialog.fcc_show_switch.label;" 368 366 tooltiptext="&vI_prefDialog.composeDialog.fcc_show_switch.tooltiptext;" prefstring="fcc_show_switch" /> … … 376 374 <checkbox id="VIdent_identity.storage_show_baseID_switch" label="&vI_prefDialog.composeDialog.show_baseID_switch.label;" 377 375 prefstring="storage_show_baseID_switch"/> 378 <checkbox id="VIdent_identity.storage_show_SMTP_switch" label="&vI_prefDialog.composeDialog.show_SMTP_switch.label;"379 prefstring="storage_show_SMTP_switch"/>380 376 </groupbox> 381 377 </tabpanel> … … 586 582 oncommand="virtualIdentityExtension.prefDialog.base.storageConstraint(this);" /> 587 583 <spacer class="paragraph"/> 588 <button id="VIdent_identity.storage.import" label="&vI_prefDialog.storage.import;" oncommand="var vI_localRdfDatasource = new virtualIdentityExtension.rdfDatasourceImporter(window, 'virtualIdentity .rdf');" />589 <button id="VIdent_identity.storage.export" label="&vI_prefDialog.storage.export;" oncommand="var vI_localRdfDatasource = new virtualIdentityExtension.rdfDatasource(window); vI_localRdfDatasource.export('virtualIdentity .rdf')" />584 <button id="VIdent_identity.storage.import" label="&vI_prefDialog.storage.import;" oncommand="var vI_localRdfDatasource = new virtualIdentityExtension.rdfDatasourceImporter(window, 'virtualIdentity_0.10.rdf');" /> 585 <button id="VIdent_identity.storage.export" label="&vI_prefDialog.storage.export;" oncommand="var vI_localRdfDatasource = new virtualIdentityExtension.rdfDatasource(window); vI_localRdfDatasource.export('virtualIdentity_0.10.rdf')" /> 590 586 </groupbox> 591 587 <groupbox> … … 620 616 <checkbox id="VIdent_identity.storage_store_base_id" label="&vI_prefDialog.storage.store_base_id.label;" 621 617 prefstring="storage_store_base_id"/> 622 <checkbox id="VIdent_identity.storage_store_SMTP" label="&vI_prefDialog.storage.store_SMTP.label;"623 prefstring="storage_store_SMTP"/>624 618 <checkbox id="VIdent_identity.storage_warn_update" label="&vI_prefDialog.storage.warn_update.label;" 625 619 prefstring="storage_warn_update"/> -
content/vI_rdfAccountMismatchDialog.js
rbc6c6b r85fa10 60 60 } 61 61 /* window.argument[2] stores callback parent */ 62 window.arguments[2].repair AccountMismatch(rdfAccountMismatchDialog.type, rdfAccountMismatchDialog.mismatchItems);62 window.arguments[2].repairMismatch(rdfAccountMismatchDialog.type, rdfAccountMismatchDialog.mismatchItems); 63 63 } 64 64 } -
content/vI_rdfAccountMismatchDialog.xul
rbc6c6b r85fa10 45 45 <description class="widthXX">&vident.virtualIdentityExtension_rdfAccountMismatchDialog_identity.desc;</description> 46 46 </vbox> 47 <vbox id="virtualIdentityExtension_rdfAccountMismatchDialog_vbox_smtp " align="left" hidden="true" >48 <caption label="&vident.virtualIdentityExtension_rdfAccountMismatchDialog_smtp .caption;"/>49 <description class="widthXX">&vident.virtualIdentityExtension_rdfAccountMismatchDialog_smtp .desc;</description>47 <vbox id="virtualIdentityExtension_rdfAccountMismatchDialog_vbox_smtpid" align="left" hidden="true" > 48 <caption label="&vident.virtualIdentityExtension_rdfAccountMismatchDialog_smtpid.caption;"/> 49 <description class="widthXX">&vident.virtualIdentityExtension_rdfAccountMismatchDialog_smtpid.desc;</description> 50 50 </vbox> 51 51 <listbox id="virtualIdentityExtension_rdfAccountMismatchDialog_listbox" suppressonselect="true" rows="5" > … … 55 55 <listheader label="&vident.virtualIdentityExtension_rdfAccountMismatchDialog_identity.new;" /> 56 56 </listhead> 57 <listhead id="virtualIdentityExtension_rdfAccountMismatchDialog_listhead_smtp " hidden="true">58 <listheader label="&vident.virtualIdentityExtension_rdfAccountMismatchDialog_smtp .old;" />59 <listheader label="&vident.virtualIdentityExtension_rdfAccountMismatchDialog_smtp .count;" />60 <listheader label="&vident.virtualIdentityExtension_rdfAccountMismatchDialog_smtp .new;" />57 <listhead id="virtualIdentityExtension_rdfAccountMismatchDialog_listhead_smtpid" hidden="true"> 58 <listheader label="&vident.virtualIdentityExtension_rdfAccountMismatchDialog_smtpid.old;" /> 59 <listheader label="&vident.virtualIdentityExtension_rdfAccountMismatchDialog_smtpid.count;" /> 60 <listheader label="&vident.virtualIdentityExtension_rdfAccountMismatchDialog_smtpid.new;" /> 61 61 </listhead> 62 62 <listcols><listcol/><listcol/><listcol/></listcols> -
content/vI_rdfDataEditor.js
rbc6c6b r85fa10 90 90 } 91 91 92 // set SMTP93 document.getElementById("virtualIdentityExtension_smtpServerListHbox").addNoneServer(); // add non (not stored) Server94 document.getElementById("virtualIdentityExtension_smtpServerListHbox").smtp = rdfDataEditor.__identityData.smtp.keyNice;95 96 92 // set extra values 97 93 rdfDataEditor.__identityData.extras.setValuesToEnvironment(); … … 145 141 var localIdentityData = new vI.identityData(window, document.getElementById("sender").value, null, 146 142 document.getElementById("virtualIdentityExtension_IdentityList").selectedItem.getAttribute("identitykey"), 147 document.getElementById("virtualIdentityExtension_SmtpServerList").selectedItem.getAttribute("key"));148 143 localIdentityData.extras.getValuesFromEnvironment(); 149 144 rdfDataEditor.__rdfDatasource.updateRDF( … … 151 146 document.getElementById("type_menu").selectedItem.getAttribute("key"), 152 147 localIdentityData, 153 true, true,rdfDataEditor.__recipient, rdfDataEditor.__type, true);148 true, rdfDataEditor.__recipient, rdfDataEditor.__type, true); 154 149 Log.debug("updateRDF done " + localIdentityData.extras.status()); 155 150 return document.getElementById("type_menu").selectedItem.getAttribute("key"); -
content/vI_rdfDataEditor.xul
rbc6c6b r85fa10 62 62 <hbox> 63 63 <vbox><spacer flex="1"/> 64 <label value="&vI_rdfDataEditor.smtp.label;" accesskey="&vI_rdfDataEditor.smtp.accesskey;" control="virtualIdentityExtension_SmtpServerList"/>65 <spacer flex="1"/></vbox>66 <!-- structure to show SMTP server -->67 <hbox id="virtualIdentityExtension_smtpServerListHbox" class="smtpServerListHbox" />68 69 <vbox><spacer flex="1"/>70 64 <label value="&vI_rdfDataEditor.identity.label;" accesskey="&vI_rdfDataEditor.identity.accesskey;" control="virtualIdentityExtension_IdentityList"/> 71 65 <spacer flex="1"/></vbox> -
content/vI_rdfDataTree.js
rbc6c6b r85fa10 134 134 indexCol: idData.length + 1 + ".", 135 135 senderCol: localIdentityData.combinedName, 136 smtpCol: localIdentityData.smtp.value,137 // smtpKey : localIdentityData.smtp.key,138 136 idCol: localIdentityData.id.value, 139 137 usedCol: usedDate, … … 244 242 .createBundle("chrome://v_identity/locale/vI_rdfDataEditor.properties"); 245 243 246 rdfDataTreeCollection._rdfDatasource = new vI.rdfDatasource(window, "virtualIdentity .rdf");244 rdfDataTreeCollection._rdfDatasource = new vI.rdfDatasource(window, "virtualIdentity_0.10.rdf"); 247 245 248 246 for (var treeType of rdfDataTreeCollection.treeTypes) … … 513 511 var treeType = rdfDataTreeCollection.tabbox.selectedPanel.id; 514 512 var newItemPreset = { 515 identityData: new vI.identityData(window, "", null, null, vI.NO_SMTP_TAG,null, null)513 identityData: new vI.identityData(window, "", null, null, null, null) 516 514 }; 517 515 var retVar = { -
content/vI_rdfDataTree.xul
rbc6c6b r85fa10 114 114 <menu id="tasksMenu" label="&tasksMenu.label;" accesskey="&tasksMenu.accesskey;"> 115 115 <menupopup> 116 <menuitem label="&importCmd.label;" accesskey="&importCmd.accesskey;" oncommand="var vI_localRdfDatasource = new virtualIdentityExtension.rdfDatasourceImporter(window, 'virtualIdentity .rdf');"/>117 <menuitem label="&exportCmd.label;" accesskey="&exportCmd.accesskey;" oncommand="var vI_localRdfDatasource = new virtualIdentityExtension.rdfDatasource(window); vI_localRdfDatasource.export('virtualIdentity .rdf')"/>116 <menuitem label="&importCmd.label;" accesskey="&importCmd.accesskey;" oncommand="var vI_localRdfDatasource = new virtualIdentityExtension.rdfDatasourceImporter(window, 'virtualIdentity_0.10.rdf');"/> 117 <menuitem label="&exportCmd.label;" accesskey="&exportCmd.accesskey;" oncommand="var vI_localRdfDatasource = new virtualIdentityExtension.rdfDatasource(window); vI_localRdfDatasource.export('virtualIdentity_0.10.rdf')"/> 118 118 </menupopup> 119 119 </menu> … … 149 149 persist="hidden width ordinal sortDirection"/> 150 150 <splitter class="tree-splitter" /> 151 <treecol id="smtpCol_email" label="&vI_rdfDataTree.smtpColumn.label;" flex="5"152 class="sortDirectionIndicator"153 persist="hidden width ordinal sortDirection"/>154 <splitter class="tree-splitter" />155 151 <treecol id="idCol_email" label="&vI_rdfDataTree.idColumn.label;" flex="10" 156 152 class="sortDirectionIndicator" … … 194 190 persist="hidden width ordinal sortDirection"/> 195 191 <splitter class="tree-splitter" /> 196 <treecol id="smtpCol_maillist" label="&vI_rdfDataTree.smtpColumn.label;" flex="5"197 class="sortDirectionIndicator"198 persist="hidden width ordinal sortDirection"/>199 <splitter class="tree-splitter" />200 192 <treecol id="idCol_maillist" label="&vI_rdfDataTree.idColumn.label;" flex="10" 201 193 class="sortDirectionIndicator" … … 238 230 persist="hidden width ordinal sortDirection"/> 239 231 <splitter class="tree-splitter" /> 240 <treecol id="smtpCol_newsgroup" label="&vI_rdfDataTree.smtpColumn.label;" flex="5"241 class="sortDirectionIndicator"242 persist="hidden width ordinal sortDirection"/>243 <splitter class="tree-splitter" />244 232 <treecol id="idCol_newsgroup" label="&vI_rdfDataTree.idColumn.label;" flex="10" 245 233 class="sortDirectionIndicator" … … 287 275 persist="hidden width ordinal"/> 288 276 <splitter class="tree-splitter" /> 289 <treecol id="smtpCol_filter" label="&vI_rdfDataTree.smtpColumn.label;" flex="5"290 class="sortDirectionIndicator"291 persist="hidden width ordinal"/>292 <splitter class="tree-splitter" />293 277 <treecol id="idCol_filter" label="&vI_rdfDataTree.idColumn.label;" flex="10" 294 278 class="sortDirectionIndicator" -
content/vI_smartReplyDialog.js
rbc6c6b r85fa10 39 39 40 40 var id = null; 41 var smtp = null;42 43 41 if (smartReply_dialog.all_addresses.identityDataCollection[index].id) 44 42 id = smartReply_dialog.all_addresses.identityDataCollection[index].id.value; 45 if (smartReply_dialog.all_addresses.identityDataCollection[index].smtp)46 smtp = smartReply_dialog.all_addresses.identityDataCollection[index].smtp.value;47 43 48 44 let defaultServerTag = Components.classes["@mozilla.org/intl/stringbundle;1"] … … 51 47 .GetStringFromName("defaultServerTag") 52 48 53 menuentry += (id ? " (" + id + " ," + (smtp ? smtp : defaultServerTag) + ")" : "")49 menuentry += (id ? " (" + id + ")" : "") 54 50 smartReply_dialog.add_row(menuentry); 55 51 } -
content/vI_statusmenu.js
rbc6c6b r85fa10 42 42 // objSaveSwitch: null, 43 43 // objSaveBaseIDSwitch: null, 44 // objSaveSMTPSwitch: null,45 44 // objFccSwitch: null, 46 45 objStatusText: null, … … 66 65 // statusmenu.objSaveBaseIDSwitch.setAttribute("hidden", !vI.vIprefs.get(data)); 67 66 // break; 68 // case "storage_show_SMTP_switch":69 // // Log.debug("changed storage_show_SMTP_switch to " + statusmenu.objSaveSMTPMenuItem + "=" + vI.vIprefs.get(data));70 // statusmenu.objSaveSMTPSwitch.setAttribute("hidden", !vI.vIprefs.get(data));71 // break;72 67 case "storage_store": 73 68 statusmenu.objStorageSaveMenuItem.setAttribute("checked", vI.vIprefs.get(data)); … … 75 70 case "storage_store_base_id": 76 71 statusmenu.objSaveBaseIDMenuItem.setAttribute("checked", vI.vIprefs.get(data)); 77 break;78 case "storage_store_SMTP":79 // Log.debug("changed storage_store_SMTP to " + statusmenu.objSaveSMTPMenuItem + "=" + vI.vIprefs.get(data));80 statusmenu.objSaveSMTPMenuItem.setAttribute("checked", vI.vIprefs.get(data));81 // Log.debug("changed storage_store_SMTP done");82 72 break; 83 73 case "storage_colorIndication": 84 74 document.getElementById("identityHbox").setAttribute("colorize", vI.vIprefs.get(data)) 85 75 document.getElementById("baseIDHbox").setAttribute("colorize", vI.vIprefs.get(data)) 86 // document.getElementById("smtpServerHbox").setAttribute("colorize", vI.vIprefs.get(data))87 76 break; 88 77 case "storage": … … 90 79 statusmenu.objStorageSaveMenuItem.removeAttribute("hidden"); 91 80 statusmenu.objSaveBaseIDMenuItem.removeAttribute("hidden"); 92 // statusmenu.objSaveSMTPMenuItem.removeAttribute("hidden");93 81 statusmenu.objStatusMenuSeparator.removeAttribute("hidden"); 94 82 } else { 95 83 statusmenu.objStorageSaveMenuItem.setAttribute("hidden", "true"); 96 84 statusmenu.objSaveBaseIDMenuItem.setAttribute("hidden", "true"); 97 // statusmenu.objSaveSMTPMenuItem.setAttribute("hidden", "true");98 85 statusmenu.objStatusMenuSeparator.setAttribute("hidden", "true"); 99 86 } … … 110 97 // vI.vIprefs.addObserver("storage_show_switch", this.observe, this); 111 98 // vI.vIprefs.addObserver("storage_show_baseID_switch", this.observe, this); 112 // vI.vIprefs.addObserver("storage_show_SMTP_switch", this.observe, this);113 99 vI.vIprefs.addObserver("storage_colorIndication", this.observe, this); 114 100 vI.vIprefs.addObserver("storage_store", this.observe, this); 115 101 vI.vIprefs.addObserver("storage_store_base_id", this.observe, this); 116 // vI.vIprefs.addObserver("storage_store_SMTP", this.observe, this);117 102 }, 118 103 … … 124 109 // vI.vIprefs.removeObserver("storage_show_switch", this.observe); 125 110 // vI.vIprefs.removeObserver("storage_show_baseID_switch", this.observe); 126 // vI.vIprefs.removeObserver("storage_show_SMTP_switch", this.observe);127 111 vI.vIprefs.removeObserver("storage_colorIndication", this.observe); 128 112 vI.vIprefs.removeObserver("storage_store", this.observe); 129 113 vI.vIprefs.removeObserver("storage_store_base_id", this.observe); 130 // vI.vIprefs.removeObserver("storage_store_SMTP", this.observe);131 114 }, 132 115 … … 135 118 statusmenu.objStatusLogo = document.getElementById("virtualIdentityExtension_Logo"); 136 119 statusmenu.objSaveBaseIDMenuItem = document.getElementById("virtualIdentityExtension_statusMenu_storage_saveBaseID"); 137 // statusmenu.objSaveSMTPMenuItem = document.getElementById("virtualIdentityExtension_statusMenu_storage_saveSMTP");138 120 statusmenu.objStorageSaveMenuItem = document.getElementById("virtualIdentityExtension_statusMenu_storage_save"); 139 121 statusmenu.objStatusMenuSeparator = document.getElementById("virtualIdentityExtension_statusMenu_separator"); 140 122 // statusmenu.objSaveSwitch = document.getElementById("virtualIdentityExtension_saveSwitch"); 141 123 // statusmenu.objSaveBaseIDSwitch = document.getElementById("virtualIdentityExtension_saveBaseIDSwitch"); 142 // statusmenu.objSaveSMTPSwitch = document.getElementById("virtualIdentityExtension_SaveSmtpSwitch");143 124 // statusmenu.objFccSwitch = document.getElementById("virtualIdentityExtension_fccSwitch"); 144 125 statusmenu.objStatusText = document.getElementById("statusText"); … … 151 132 // statusmenu.observe(this, null, null, "storage_show_switch"); 152 133 // statusmenu.observe(this, null, null, "storage_show_baseID_switch"); 153 // statusmenu.observe(this, null, null, "storage_show_SMTP_switch");154 134 statusmenu.observe(this, null, null, "storage_colorIndication"); 155 135 statusmenu.observe(this, null, null, "storage_store_base_id"); 156 // statusmenu.observe(this, null, null, "storage_store_SMTP");157 136 statusmenu.observe(this, null, null, "storage_store"); 158 137 statusmenu.observe(this, null, null, "storage"); … … 160 139 161 140 __timeout: 5, // timeout for status messages in seconds 162 __addStatusMessage: function (save , smtp) {141 __addStatusMessage: function (save) { 163 142 if (vI.vIprefs.get("show_status")) { 164 143 var sourceString = "vident.statusText.save." + save; 165 if (smtp != "off") sourceString = sourceString + ".smtp"166 144 var messageLine1 = statusmenu.stringBundle.GetStringFromName(sourceString + ".line1"); 167 145 var messageLine2 = statusmenu.stringBundle.GetStringFromName(sourceString + ".line2"); … … 184 162 }, 185 163 186 changeSMTPStatus: function (elem) {187 // statusmenu.objSaveSMTPMenuItem.setAttribute("checked", elem.getAttribute("checked"));188 statusmenu.menuConstraint();189 },190 191 164 changeBaseIDStatus: function (elem) { 192 165 statusmenu.objSaveBaseIDMenuItem.setAttribute("checked", elem.getAttribute("checked")); … … 201 174 menuConstraint: function () { 202 175 var save = "off"; 203 var smtp = "off";204 176 if (statusmenu.objStorageSaveMenuItem.getAttribute("checked") == "true") { 205 // statusmenu.objSaveSMTPMenuItem.removeAttribute("disabled");206 177 statusmenu.objSaveBaseIDMenuItem.removeAttribute("disabled"); 207 178 if (vI.vIprefs.get("storage")) { 208 179 if (statusmenu.objSaveBaseIDMenuItem.getAttribute("checked") == "true") save = "base"; 209 180 else save = "ok"; 210 // if (statusmenu.objSaveSMTPMenuItem.getAttribute("checked") == "true") smtp = "save";211 181 } 212 182 } else { 213 // statusmenu.objSaveSMTPMenuItem.setAttribute("disabled", "true");214 183 statusmenu.objSaveBaseIDMenuItem.setAttribute("disabled", "true"); 215 184 } 216 185 statusmenu.objStatusMenu.setAttribute("save", save); 217 statusmenu.objStatusMenu.setAttribute("smtp", smtp); 218 statusmenu.__addStatusMessage(save, smtp); 186 statusmenu.__addStatusMessage(save); 219 187 }, 220 188 … … 224 192 225 193 var curSaveStatus = vI.vIprefs.get("storage_store") 226 var curSaveSMTPStatus = vI.vIprefs.get("storage_store_SMTP")227 194 var curSaveBaseIDStatus = vI.vIprefs.get("storage_store_base_id") 228 var newSaveStatus = ((!curSaveStatus) || (curSaveStatus && !curSaveSMTPStatus) || (curSaveStatus && !curSaveBaseIDStatus)) 229 var newSaveSMTPStatus = ((!curSaveSMTPStatus && curSaveStatus) || (curSaveBaseIDStatus && !curSaveSMTPStatus)) 230 var newSaveBaseIDStatus = ((curSaveSMTPStatus && curSaveStatus && !curSaveBaseIDStatus) || (curSaveBaseIDStatus && !curSaveSMTPStatus)) 195 var newSaveStatus = ((!curSaveStatus) || (curSaveStatus && !curSaveBaseIDStatus)) 196 var newSaveBaseIDStatus = (curSaveStatus && !curSaveBaseIDStatus) 231 197 232 198 vI.vIprefs.set("storage_store", newSaveStatus) 233 vI.vIprefs.set("storage_store_SMTP", newSaveSMTPStatus)234 199 vI.vIprefs.set("storage_store_base_id", newSaveBaseIDStatus) 235 200 -
content/v_identity.js
rbc6c6b r85fa10 119 119 // store identitykey locally to enable restoring after selection of next virtual identity without identitykey 120 120 identityElement.setAttribute("identitykey", identityElement.selectedItem.getAttribute("identitykey")); 121 122 // we are not using the smtp display, smtp is selected based on base identity123 //dentityElement.setAttribute("smtp", identityElement.identityData.smtp.value);124 121 125 122 identityElement.vid = identityElement.selectedItem.vid; … … 314 311 _uninstall: false, 315 312 observe: function (subject, topic, data) { 316 if (topic == "am-smtpChanges") {317 Log.debug("smtp changes observed");318 var msgIdentity = document.getElementById("msgIdentity");319 document.getAnonymousElementByAttribute(msgIdentity, "class", "smtpServerListHbox").refresh();320 }321 313 if (topic == "am-acceptChanges") { 322 314 Log.debug("account changes observed"); … … 348 340 var obsService = Components.classes["@mozilla.org/observer-service;1"]. 349 341 getService(Components.interfaces.nsIObserverService) 350 obsService.addObserver(this, "am-smtpChanges", false);351 342 obsService.addObserver(this, "am-acceptChanges", false); 352 343 }, … … 354 345 var obsService = Components.classes["@mozilla.org/observer-service;1"]. 355 346 getService(Components.interfaces.nsIObserverService) 356 obsService.removeObserver(this, "am-smtpChanges");357 347 obsService.removeObserver(this, "am-acceptChanges"); 358 348 } -
content/v_identity.xul
rbc6c6b r85fa10 86 86 <menuitem type="checkbox" id="virtualIdentityExtension_statusMenu_storage_saveBaseID" label="&vident.vI_Menu.saveBaseID.label;" 87 87 oncommand="virtualIdentityExtension.vIprefs.set('storage_store_base_id', (this.getAttribute('checked') == 'true'));"/> 88 <!-- <menuitem type="checkbox" id="virtualIdentityExtension_statusMenu_storage_saveSMTP" label="&vident.vI_Menu.saveSMTP.label;"89 oncommand="virtualIdentityExtension.vIprefs.set('storage_store_SMTP', (this.getAttribute('checked') == 'true'));"/>-->90 88 <menuseparator id="virtualIdentityExtension_statusMenu_separator" /> 91 89 <menuitem class="menuitem-iconic" label="&vident.vI_Menu.Settings.label;" -
defaults/preferences/preferences.js
rbc6c6b r85fa10 10 10 pref("extensions.virtualIdentity.copyAttachVCardSettings", false); 11 11 pref("extensions.virtualIdentity.copyNewEnigmailSettings", true); 12 pref("extensions.virtualIdentity.show_smtp", false);13 12 pref("extensions.virtualIdentity.show_status", true); 14 13 pref("extensions.virtualIdentity.fcc_show_switch", false); … … 43 42 pref("extensions.virtualIdentity.storage_store", true); 44 43 pref("extensions.virtualIdentity.storage_store_base_id", false); 45 pref("extensions.virtualIdentity.storage_store_SMTP", false);46 44 pref("extensions.virtualIdentity.storage_dont_update_multiple", true); 47 45 pref("extensions.virtualIdentity.storage_show_switch", false); 48 46 pref("extensions.virtualIdentity.storage_show_baseID_switch", false); 49 pref("extensions.virtualIdentity.storage_show_SMTP_switch", false);50 47 pref("extensions.virtualIdentity.storage_colorIndication", true); 51 48 pref("extensions.virtualIdentity.storage_warn_update", true); -
modules/vI_identityData.js
rbc6c6b r85fa10 44 44 Components.utils.import("resource://v_identity/identityDataExtras/PGPMIME.js"); 45 45 46 function identityData(currentWindow, email, fullName, id, smtp, extras, sideDescription, existingID) { 46 ChromeUtils.import("resource:///modules/mailServices.js"); 47 48 function identityData(currentWindow, email, fullName, id, extras, sideDescription, existingID) { 47 49 this._currentWindow = currentWindow; 48 50 this._email = email ? email : ""; … … 50 52 this._fullName = fullName ? fullName : ""; 51 53 this.id = new idObj(id); 52 this.smtp = new smtpObj(smtp);53 54 if (extras) this.extras = extras; 54 55 else this.extras = new identityDataExtras(currentWindow); … … 58 59 fullName: {}, 59 60 email: {}, 60 smtp: {},61 61 id: {}, 62 62 extras: {} … … 76 76 _currentWindow: null, 77 77 id: null, 78 smtp: null,79 78 extras: null, 80 79 sideDescription: null, … … 139 138 return this.__makeHtml(this.id.value); 140 139 }, 141 get smtpHtml() {142 return this.__makeHtml(this.smtp.value);143 },144 140 get fullNameHtml() { 145 141 return this.__makeHtml(this.fullName); … … 155 151 return this.stringBundle.GetStringFromName("vident.identityData.baseID") 156 152 }, 157 get smtpLabel() {158 return this.stringBundle.GetStringFromName("vident.identityData.SMTP")159 },160 153 get fullNameLabel() { 161 154 return this.stringBundle.GetStringFromName("vident.identityData.Name") … … 167 160 // creates an Duplicate of the current IdentityData, cause usually we are working with a pointer 168 161 getDuplicate: function () { 169 return new identityData(this._currentWindow, this.email, this.fullName, this.id.key, this. smtp.key, this.extras ? this.extras.getDuplicate() : null,162 return new identityData(this._currentWindow, this.email, this.fullName, this.id.key, this.extras ? this.extras.getDuplicate() : null, 170 163 this.sideDescription, this.existingID); 171 164 }, … … 178 171 if (identityData.id.key) 179 172 this.id.key = identityData.id.key; 180 if (identityData.smtp.key)181 this.smtp.key = identityData.smtp.key;182 173 if (identityData.sideDescription) 183 174 this.sideDescription = identityData.sideDescription; … … 191 182 this.fullName = identityData.fullName; 192 183 this.id.key = identityData.id.key; 193 this.smtp.key = identityData.smtp.key;194 184 this.sideDescription = identityData.sideDescription; 195 185 if (this.extras) this.extras.copy(identityData.extras); … … 200 190 isExistingIdentity: function (ignoreFullNameWhileComparing) { 201 191 Log.debug("isExistingIdentity: ignoreFullNameWhileComparing='" + ignoreFullNameWhileComparing + "'"); 202 // Log.debug("base: fullName.toLowerCase()='" + this.fullName + "' email.toLowerCase()='" + this.email + "' smtp='" + this.smtp.key + "'");192 // Log.debug("base: fullName.toLowerCase()='" + this.fullName + "' email.toLowerCase()='" + this.email + "'"); 203 193 204 194 var ignoreFullNameMatchKey = null; … … 213 203 for (let i = 0; i < identities.length; i++) { 214 204 let identity = identities[i]; 215 // Log.debug("comp: fullName.toLowerCase()='" + identity.fullName.toLowerCase() + "' email.toLowerCase()='" + identity.email.toLowerCase() + "' smtp='" + identity.smtpServerKey + "'");205 // Log.debug("comp: fullName.toLowerCase()='" + identity.fullName.toLowerCase() + "' email.toLowerCase()='" + identity.email.toLowerCase() + "'"); 216 206 var email = this.email ? this.email : ""; // might be null if no identity is set 217 207 var idEmail = identity.email ? identity.email : ""; // might be null if no identity is set 218 if ((email.toLowerCase() == idEmail.toLowerCase()) && 219 this.smtp.equal(new smtpObj(identity.smtpServerKey))) { 208 if (email.toLowerCase() == idEmail.toLowerCase()) { 220 209 // if fullName matches, than this is a final match 221 210 if (this.fullName.toLowerCase() == identity.fullName.toLowerCase()) { … … 288 277 } 289 278 290 this.comp.equals.smtp = this.smtp.equal(compareIdentityData.smtp);291 279 this.comp.equals.id = this.id.equal(compareIdentityData.id); 292 280 this.comp.equals.extras = this.extras ? this.extras.equal(compareIdentityData.extras) : true; 293 281 294 return (this.comp.equals.fullName && this.comp.equals.email && this.comp.equals. smtp && this.comp.equals.id && this.comp.equals.extras);282 return (this.comp.equals.fullName && this.comp.equals.email && this.comp.equals.id && this.comp.equals.extras); 295 283 }, 296 284 … … 307 295 308 296 getCompareMatrix: function () { 309 const Items = Array("fullName", "email", " smtp", "id");297 const Items = Array("fullName", "email", "id"); 310 298 var string = ""; 311 299 var saveBaseId = vIprefs.get("storage_store_base_id"); 312 var saveSMTP = vIprefs.get("storage_store_SMTP");313 300 for (let item of Items) { 314 301 var classEqual = (this.comp.equals[item]) ? "equal" : "unequal"; 315 var classIgnore = (( (!saveBaseId) && (item == "id")) || ((!saveSMTP) && (item == "smtp"))) ? " ignoreValues" : ""302 var classIgnore = ((!saveBaseId) && (item == "id")) ? " ignoreValues" : "" 316 303 string += "<tr>" + 317 304 "<td class='col1 " + classEqual + "'>" + this[item + "Label"] + "</td>" + … … 325 312 326 313 getMatrix: function () { 327 const Items = Array("smtp", "id");328 314 var string = ""; 329 for (var item of Items) if (this[item + "Html"])330 string += "<tr><td class='col1'>" + this[item + "Label"] + ":</td>" +331 "<td class='col2'>" + this[ item + "Html"] + "</td></tr>"315 if (this["idHtml"]) 316 string = "<tr><td class='col1'>" + this["idLabel"] + ":</td>" + 317 "<td class='col2'>" + this["idHtml"] + "</td></tr>" 332 318 string += this.extras ? this.extras.getMatrix() : ""; 333 319 return string; … … 363 349 if (this.identityDataCollection[index].email == identityData.email && 364 350 (!this.identityDataCollection[index].id.key || !identityData.id.key || 365 (this.identityDataCollection[index].id.key == identityData.id.key && 366 this.identityDataCollection[index].smtp.key == identityData.smtp.key))) { 351 this.identityDataCollection[index].id.key == identityData.id.key)) { 367 352 // found, so check if we can use the Name of the new field 368 353 if (this.identityDataCollection[index].fullName == "" && identityData.fullName != "") { … … 370 355 Log.debug("added fullName '" + identityData.fullName + "' to stored email '" + this.identityDataCollection[index].email + "'") 371 356 } 372 // check if id_key , smtp_keyor extras can be used357 // check if id_key or extras can be used 373 358 // only try this once, for the first Identity where id is set) 374 359 if (!this.identityDataCollection[index].id.key && identityData.id.key) { 375 360 this.identityDataCollection[index].id.key = identityData.id.key; 376 this.identityDataCollection[index].smtp.key = identityData.smtp.key;377 361 this.identityDataCollection[index].extras = identityData.extras; 378 Log.debug("added id '" + identityData.id.value + "' smtp '" + identityData.smtp.value + "'(+extras) to stored email '" + this.identityDataCollection[index].email + "'")362 Log.debug("added id '" + identityData.id.value + "' (+extras) to stored email '" + this.identityDataCollection[index].email + "'") 379 363 } 380 364 return; … … 393 377 } 394 378 }; 395 396 function smtpObj(key) {397 this._key = key;398 this.DEFAULT_TAG = Components.classes["@mozilla.org/intl/stringbundle;1"]399 .getService(Components.interfaces.nsIStringBundleService)400 .createBundle("chrome://messenger/locale/messenger.properties").401 GetStringFromName("defaultServerTag");402 }403 smtpObj.prototype = {404 DEFAULT_TAG: null,405 _key: null,406 _value: null,407 408 set key(key) {409 this._key = key;410 this._value = null;411 },412 get key() {413 var dummy = this.value; // just to be sure key is adapted if SMTP is not available414 return this._key415 },416 get keyNice() { // the same as key but with "" for DEFAULT_SMTP_TAG417 if (this.key == DEFAULT_SMTP_TAG) return ""; // this is the key used for default server418 return this.key419 },420 get value() {421 if (this._value == null) {422 this._value = "";423 if (this._key == null || this._key == "") this._key = DEFAULT_SMTP_TAG;424 if (this._key == DEFAULT_SMTP_TAG) this._value = this.DEFAULT_TAG;425 else if (!this._key) this._value = null;426 else if (this._key) {427 var servers, smtpService = Components.classes["@mozilla.org/messengercompose/smtp;1"]428 .getService(Components.interfaces.nsISmtpService);429 // check for new https://hg.mozilla.org/comm-central/rev/fab9e5145cd4 smtpService430 if (typeof (smtpService.servers) == "object") servers = smtpService.servers;431 else servers = smtpService.smtpServers;432 433 while (servers && servers.hasMoreElements()) {434 var server = servers.getNext();435 if (server instanceof Components.interfaces.nsISmtpServer &&436 !server.redirectorType && this._key == server.key) {437 this._value = server.description ? server.description : server.hostname;438 break;439 }440 }441 }442 }443 if (!this._value) this._key = NO_SMTP_TAG; // if non-existant SMTP handle like non available444 return this._value;445 },446 equal: function (compareSmtpObj) {447 if (this.key == NO_SMTP_TAG || compareSmtpObj.key == NO_SMTP_TAG) return true;448 if (this.keyNice != compareSmtpObj.keyNice) {449 // Log.debug("smtp not equal ('" + this.keyNice + "' != '" + compareSmtpObj.keyNice + "')");450 }451 return (this.keyNice == compareSmtpObj.keyNice);452 },453 hasNoDefinedSMTP: function () {454 return (this.key == NO_SMTP_TAG);455 }456 }457 379 458 380 function idObj(key) { … … 502 424 return this._value; 503 425 }, 426 427 get smtpServerKey() { 428 if (!this.key) 429 return null; 430 var AccountManager = Components.classes["@mozilla.org/messenger/account-manager;1"] 431 .getService(Components.interfaces.nsIMsgAccountManager); 432 433 var identity = AccountManager.getIdentity(this.key); 434 if (identity) { 435 if (identity.smtpServerKey) 436 return identity.smtpServerKey; 437 else 438 return MailServices.smtp.defaultServer.key 439 } 440 return null; 441 }, 442 443 get smtpServerName() { 444 if (!this.smtpServerKey) 445 return null; 446 var servers = MailServices.smtp.servers; 447 448 var smtpName; 449 while (servers && servers.hasMoreElements()) { 450 var server = servers.getNext(); 451 if (server instanceof Components.interfaces.nsISmtpServer && 452 !server.redirectorType && this.smtpServerKey == server.key) { 453 smtpName = server.description ? server.description : server.hostname; 454 break; 455 } 456 } 457 return smtpName; 458 }, 459 504 460 equal: function (compareIdObj) { 505 461 if (!this.key || !compareIdObj.key) return true; -
modules/vI_rdfDatasource.js
rbc6c6b r85fa10 32 32 Components.utils.import("resource://v_identity/vI_identityData.js"); 33 33 Components.utils.import("resource://gre/modules/Services.jsm"); 34 35 ChromeUtils.import("resource:///modules/mailServices.js"); 34 36 35 37 // if no 3pane-window found, return current window … … 68 70 this._currentWindow = currentWindow; 69 71 this._rdfFileName = rdfFileName; 72 this._dontRegisterObserver = dontRegisterObserver; 70 73 if (this._rdfFileName) this.init(); 71 if (!dontRegisterObserver) this.AccountManagerObserver.register(this); 72 try { 73 this._extVersion = get3PaneWindow().virtualIdentityExtension.extensionVersion; 74 } catch (e) {} 74 if (!this._dontRegisterObserver) this.AccountManagerObserver.register(this); 75 this._extVersion = get3PaneWindow().virtualIdentityExtension.extensionVersion; 76 Log.debug("rdfDatasource: read ext. Version '" + this._extVersion + "'"); 75 77 } 76 78 … … 78 80 _currentWindow: null, 79 81 _extVersion: null, 80 _rdfVersion: "0.0. 5",82 _rdfVersion: "0.0.6", 81 83 _rdfService: Components.classes["@mozilla.org/rdf/rdf-service;1"] 82 84 .getService(Components.interfaces.nsIRDFService), … … 91 93 _rdfNSAccounts: "vIAccounts", 92 94 _rdfNSIdentities: "vIAccounts/id", 93 _rdfNSSMTPservers: "vIAccounts/smtp",94 95 95 96 _virtualIdentityID: "{dddd428e-5ac8-4a81-9f78-276c734f75b8}", 96 97 98 _dontRegisterObserver: false, 99 97 100 _emailContainer: Components.classes["@mozilla.org/rdf/container;1"] 98 101 .createInstance(Components.interfaces.nsIRDFContainer), … … 108 111 109 112 _identityContainer: Components.classes["@mozilla.org/rdf/container;1"] 110 .createInstance(Components.interfaces.nsIRDFContainer),111 112 _smtpContainer: Components.classes["@mozilla.org/rdf/container;1"]113 113 .createInstance(Components.interfaces.nsIRDFContainer), 114 114 … … 125 125 case "identity": 126 126 return this._identityContainer; 127 case "smtp":128 return this._smtpContainer;129 127 } 130 128 return null; … … 187 185 .GetResource(this._rdfNS + this._rdfNSIdentities); 188 186 this._identityContainer.Init(this._rdfDataSource, storageRes); 189 storageRes = this._rdfService190 .GetResource(this._rdfNS + this._rdfNSSMTPservers);191 this._smtpContainer.Init(this._rdfDataSource, storageRes);192 187 } catch (e) {}; 193 188 }, … … 216 211 switch (currentVersion) { 217 212 case null: 218 case "0.0.1":219 case "0.0.2":220 213 this._createRDFContainers(); // no break 221 case "0.0.3":222 this._tagDefaultSMTP();223 case "0.0.4":224 214 default: 225 215 this._createAccountInfoContainers(); … … 256 246 } 257 247 }, 258 // ************** RDF UPGRADE CODE **************************************************** 259 _tagDefaultSMTP: function () { 260 Log.debug("upgrade: tagDefaultSMTP"); 261 for (let treeType of Array("email", "maillist", "newsgroup", "filter")) { 262 var enumerator = this.getContainer(treeType).GetElements(); 263 while (enumerator && enumerator.hasMoreElements()) { 264 var resource = enumerator.getNext(); 265 resource.QueryInterface(Components.interfaces.nsIRDFResource); 266 var smtp = this._getRDFValue(resource, "smtp") 267 if (!smtp || smtp == "") this._setRDFValue(resource, "smtp", DEFAULT_SMTP_TAG); 268 } 269 } 270 }, 271 // ************** RDF UPGRADE CODE **************************************************** 248 272 249 _createAccountInfoContainers: function () { 273 250 Log.debug("upgrade: createAccountInfoContainers"); … … 279 256 var identityRes = this._rdfService 280 257 .GetResource(this._rdfNS + this._rdfNSIdentities); 281 var smtpRes = this._rdfService 282 .GetResource(this._rdfNS + this._rdfNSSMTPservers); 258 283 259 this._setRDFValue(accountRes, "name", "Accounts"); 284 260 this._setRDFValue(identityRes, "name", "Identities"); 285 this._setRDFValue(smtpRes, "name", "SMTP-Server");286 261 287 262 rdfContainerUtils.MakeBag(this._rdfDataSource, accountRes); 288 263 rdfContainerUtils.MakeBag(this._rdfDataSource, identityRes); 289 rdfContainerUtils.MakeBag(this._rdfDataSource, smtpRes);290 264 291 265 var accountContainer = Components.classes["@mozilla.org/rdf/container;1"]. … … 296 270 // append all new containers to accountRes 297 271 if (accountContainer.IndexOf(identityRes) == -1) accountContainer.AppendElement(identityRes); 298 if (accountContainer.IndexOf(smtpRes) == -1) accountContainer.AppendElement(smtpRes);299 272 300 273 this._initContainers(); … … 371 344 372 345 clean: function () { 373 this.AccountManagerObserver.unregister();346 if (!this._dontRegisterObserver) this.AccountManagerObserver.unregister(); 374 347 this._flush(); 375 348 }, … … 401 374 this._unsetRDFValue(resource, "email", this._getRDFValue(resource, "email")) 402 375 this._identityContainer.RemoveElement(resource, false); 403 }404 405 enumerator = this._smtpContainer.GetElements();406 while (enumerator && enumerator.hasMoreElements()) {407 var resource = enumerator.getNext();408 resource.QueryInterface(Components.interfaces.nsIRDFResource);409 this._unsetRDFValue(resource, "label", this._getRDFValue(resource, "label"))410 this._unsetRDFValue(resource, "hostname", this._getRDFValue(resource, "hostname"))411 this._unsetRDFValue(resource, "username", this._getRDFValue(resource, "username"))412 this._smtpContainer.RemoveElement(resource, false);413 376 } 414 377 }, … … 482 445 }, 483 446 484 repair AccountMismatch: function (type, mismatchItems) {485 var keyField = (type == "identity") ? "id" : "smtp" // field to change is 'id' or 'smtp' dependent on type447 repairMismatch: function (type, mismatchItems) { 448 // type might be 'id' or 'smtpid' - dependent on trigger 486 449 for (var i = 0; i < mismatchItems.length; i++) { 487 450 Log.debug("repairAccountMismatch change " + mismatchItems[i].oldkey + " into " + mismatchItems[i].key); … … 492 455 var resource = enumerator.getNext(); 493 456 resource.QueryInterface(Components.interfaces.nsIRDFResource); 494 if (this._getRDFValue(resource, keyField) == mismatchItems[i].oldkey) { 495 if (mismatchItems[i].key == "") this._unsetRDFValue(resource, keyField, mismatchItems[i].oldkey) 496 else this._setRDFValue(resource, keyField, mismatchItems[i].key) 457 458 // old smtp (stored in pre-0.10 rdf) and id have to match, set new id 459 if (type == 'smtpid') { 460 var smtp = mismatchItems[i].oldkey.split("-")[0]; 461 var id = mismatchItems[i].oldkey.split("-")[1]; 462 if (this._getRDFValue(resource, 'id') == id && this._getRDFValue(resource, 'smtp') == smtp) { 463 if (mismatchItems[i].key == "") this._unsetRDFValue(resource, 'id', id) 464 else this._setRDFValue(resource, 'id', mismatchItems[i].key) 465 } 466 } 467 // 'id' replacement 468 else if (this._getRDFValue(resource, 'id') == mismatchItems[i].oldkey) { 469 if (mismatchItems[i].key == "") this._unsetRDFValue(resource, 'id', mismatchItems[i].oldkey) 470 else this._setRDFValue(resource, 'id', mismatchItems[i].key) 497 471 } 498 472 } 499 473 } 500 }501 },502 503 getRelevantSMTPs: function () {504 var relevantSMTPs = new Object();505 // search relevant SMTPs506 for (let treeType of Array("email", "maillist", "newsgroup", "filter")) {507 var enumerator = this.getContainer(treeType).GetElements();508 while (enumerator && enumerator.hasMoreElements()) {509 var resource = enumerator.getNext();510 resource.QueryInterface(Components.interfaces.nsIRDFResource);511 var smtp = this._getRDFValue(resource, "smtp")512 if (smtp && smtp != DEFAULT_SMTP_TAG) {513 if (!relevantSMTPs[smtp]) relevantSMTPs[smtp] = 1;514 else relevantSMTPs[smtp] += 1;515 }516 }517 }518 return relevantSMTPs;519 },520 521 searchSmtpMismatch: function () {522 Log.debug("searchSmtpMismatch");523 524 var relevantSMTPs = this.getRelevantSMTPs();525 var mismatchSMTPs = [];526 527 for (var smtp in relevantSMTPs) {528 var servers, smtpService = Components.classes["@mozilla.org/messengercompose/smtp;1"]529 .getService(Components.interfaces.nsISmtpService);530 // check for new https://hg.mozilla.org/comm-central/rev/fab9e5145cd4 smtpService531 if (typeof (smtpService.servers) == "object") servers = smtpService.servers;532 else servers = smtpService.smtpServers;533 534 var found = false;535 while (servers && servers.hasMoreElements()) {536 var server = servers.getNext();537 if (server instanceof Components.interfaces.nsISmtpServer &&538 !server.redirectorType && smtp == server.key) {539 found = true;540 break;541 }542 }543 var resource = this._rdfService.GetResource(this._rdfNS + this._rdfNSSMTPservers + "/" + smtp);544 var rdfSMTPlabel = this._getRDFValue(resource, "label");545 var rdfHostname = this._getRDFValue(resource, "hostname");546 var rdfUsername = this._getRDFValue(resource, "username")547 if (!found || rdfSMTPlabel != (server.description ? server.description : server.hostname) && rdfHostname != server.hostname)548 mismatchSMTPs.push({549 oldkey: smtp,550 label: rdfSMTPlabel,551 ext1: rdfHostname,552 ext2: rdfUsername,553 count: relevantSMTPs[smtp],554 key: ""555 })556 }557 if (mismatchSMTPs.length > 0) {558 Log.debug(" found mismatches on smtp(s).");559 get3PaneWindow().openDialog("chrome://v_identity/content/vI_rdfAccountMismatchDialog.xul", 0,560 "chrome, dialog, modal, alwaysRaised, resizable=yes", "smtp", mismatchSMTPs,561 /* callback: */562 this).focus();563 return true;564 } else {565 Log.debug(" found no mismatch");566 return false;567 474 } 568 475 }, … … 588 495 } 589 496 } 590 591 function storeSmtp(server, parent) {592 // Log.debug("storeAccounts smtp store id " + server.key);593 var resource = parent._rdfService.GetResource(parent._rdfNS + parent._rdfNSSMTPservers + "/" + server.key);594 parent._setRDFValue(resource, "label", (server.description ? server.description : server.hostname));595 parent._setRDFValue(resource, "hostname", server.hostname);596 parent._setRDFValue(resource, "username", server.username);597 var position = parent._smtpContainer.IndexOf(resource); // check for index in new recType598 if (position != -1) parent._smtpContainer.InsertElementAt(resource, position, false);599 else parent._smtpContainer.AppendElement(resource);600 }601 602 var servers, smtpService = Components.classes["@mozilla.org/messengercompose/smtp;1"]603 .getService(Components.interfaces.nsISmtpService);604 // check for new https://hg.mozilla.org/comm-central/rev/fab9e5145cd4 smtpService605 if (typeof (smtpService.servers) == "object") servers = smtpService.servers;606 else servers = smtpService.smtpServers;607 608 while (servers && servers.hasMoreElements()) {609 var server = servers.getNext();610 if (server instanceof Components.interfaces.nsISmtpServer && !server.redirectorType) storeSmtp(server, this);611 }612 613 // Log.debug("storeAccounts done");614 497 }, 615 498 … … 679 562 this._unsetRDFValue(resource, "fullName", this._getRDFValue(resource, "fullName")) 680 563 this._unsetRDFValue(resource, "id", this._getRDFValue(resource, "id")) 681 this._unsetRDFValue(resource, "smtp", this._getRDFValue(resource, "smtp"))682 564 this._unsetRDFValue(resource, "name", this._getRDFValue(resource, "name")) 683 565 … … 714 596 var fullName = this._getRDFValue(resource, "fullName") 715 597 var id = this._getRDFValue(resource, "id") 716 var smtp = this._getRDFValue(resource, "smtp")717 598 var used = this._getRDFValue(resource, "timeUsed") 718 599 var changed = this._getRDFValue(resource, "timeChanged") 719 if (!smtp) smtp = NO_SMTP_TAG;720 600 let self = this; 721 var localIdentityData = new identityData(this._currentWindow, email, fullName, id, smtp,601 var localIdentityData = new identityData(this._currentWindow, email, fullName, id, 722 602 new identityDataExtras(this._currentWindow, self, resource)) 723 603 addNewDatum(resource, name, localIdentityData, idData, used, changed) … … 739 619 } else { 740 620 Log.debug("__getDescriptionAndType: '" + recipient + "' is no MailList"); 741 var localIdentityData = new identityData(this._currentWindow, recipient, null, null, null, null, null , null);621 var localIdentityData = new identityData(this._currentWindow, recipient, null, null, null, null, null); 742 622 return { 743 623 recDesc: localIdentityData.combinedName, … … 847 727 var fullName = this._getRDFValue(resource, "fullName") 848 728 var id = this._getRDFValue(resource, "id") 849 var smtp = this._getRDFValue(resource, "smtp")850 if (!smtp) smtp = NO_SMTP_TAG;851 729 852 730 let _date = new Date(); … … 854 732 855 733 Log.debug("email='" + email + 856 "' fullName='" + fullName + "' id='" + id + "' smtp='" + smtp + "'");734 "' fullName='" + fullName + "' id='" + id + "'"); 857 735 858 736 let self = this; 859 var localIdentityData = new identityData(this._currentWindow, email, fullName, id, smtp,737 var localIdentityData = new identityData(this._currentWindow, email, fullName, id, 860 738 new identityDataExtras(this._currentWindow, self, resource)) 861 739 return localIdentityData; … … 874 752 this.updateRDF(recipient.recDesc, recipient.recType, identityData, 875 753 vIprefs.get("storage_store_base_id"), 876 vIprefs.get("storage_store_SMTP"),877 754 null, null, false); 878 755 }, … … 885 762 }, 886 763 887 updateRDF: function (recDescription, recType, localIdentityData, storeBaseID, storeSMTP,prevRecDescription, prevRecType, updateAllExtras) {764 updateRDF: function (recDescription, recType, localIdentityData, storeBaseID, prevRecDescription, prevRecType, updateAllExtras) { 888 765 // Log.debug("(" + this._rdfNS + "): updateRDF recDescription=" + recDescription + " localIdentityData.email=" + localIdentityData.email); 889 766 … … 911 788 this._setRDFValue(resource, "id", localIdentityData.id.key); 912 789 else this._unsetRDFValue(resource, "id", this._getRDFValue(resource, "id")) 913 if (storeSMTP && localIdentityData.smtp.key != NO_SMTP_TAG)914 this._setRDFValue(resource, "smtp", localIdentityData.smtp.key);915 else this._unsetRDFValue(resource, "smtp", this._getRDFValue(resource, "smtp"))916 790 this._setRDFValue(resource, "name", recDescription); 917 791 … … 953 827 _uninstall: false, 954 828 observe: function (subject, topic, data) { 955 if (topic == "am- smtpChanges" || topic == "am-acceptChanges") {956 Log.debug("account/ smtpchanges observed");829 if (topic == "am-acceptChanges") { 830 Log.debug("account/identity changes observed"); 957 831 this.self.searchIdentityMismatch(); 958 this.self.searchSmtpMismatch();959 832 this.self.refreshAccountInfo(); 960 833 } … … 965 838 var obsService = Components.classes["@mozilla.org/observer-service;1"]. 966 839 getService(Components.interfaces.nsIObserverService) 967 obsService.addObserver(this, "am-smtpChanges", false);968 840 obsService.addObserver(this, "am-acceptChanges", false); 969 841 }, 970 842 unregister: function () { 843 Log.debug("unregister AccountManagerObserver"); 971 844 var obsService = Components.classes["@mozilla.org/observer-service;1"]. 972 845 getService(Components.interfaces.nsIObserverService) 973 846 try { 974 obsService.removeObserver(this, "am-smtpChanges");975 847 obsService.removeObserver(this, "am-acceptChanges"); 976 848 } catch (e) {}; … … 982 854 function rdfDatasourceAccess(currentWindow) { 983 855 this._currentWindow = currentWindow; 984 this._rdfDataSource = new rdfDatasource(this._currentWindow, "virtualIdentity .rdf", false);856 this._rdfDataSource = new rdfDatasource(this._currentWindow, "virtualIdentity_0.10.rdf", false); 985 857 this.stringBundle = Services.strings.createBundle("chrome://v_identity/locale/v_identity.properties"); 986 858 } … … 1128 1000 1129 1001 // create with name of the file to import into 1130 function rdfDatasourceImporter(currentWindow, rdfFileName ) {1002 function rdfDatasourceImporter(currentWindow, rdfFileName, importNow = true) { 1131 1003 this._currentWindow = currentWindow; 1132 1004 this._rdfFileName = rdfFileName; 1133 if ( this._rdfFileName) this.import();1005 if (importNow && this._rdfFileName) this.import(); 1134 1006 } 1135 1007 … … 1151 1023 if (name == identity.identityName || (fullName == identity.fullName && email == identity.email)) return identity.key; 1152 1024 } 1153 }1154 return null;1155 },1156 1157 _getMatchingSMTP: function (label, hostname, username) {1158 var servers, smtpService = Components.classes["@mozilla.org/messengercompose/smtp;1"]1159 .getService(Components.interfaces.nsISmtpService);1160 // check for new https://hg.mozilla.org/comm-central/rev/fab9e5145cd4 smtpService1161 if (typeof (smtpService.servers) == "object") servers = smtpService.servers;1162 else servers = smtpService.smtpServers;1163 1164 while (servers && servers.hasMoreElements()) {1165 var server = servers.getNext();1166 if (server instanceof Components.interfaces.nsISmtpServer && !server.redirectorType)1167 if (label == (server.description ? server.description : server.hostname) || (hostname == server.hostname && username == server.username))1168 return server.key;1169 1025 } 1170 1026 return null; … … 1208 1064 }, 1209 1065 1210 _translateRelevantSMTPs: function () { 1211 var relevantSMTPs = this._rdfImportDataSource.getRelevantSMTPs(); 1212 for (var smtp in relevantSMTPs) { 1213 var resource = this._rdfService.GetResource(this._rdfImportDataSource._rdfNS + this._rdfImportDataSource._rdfNSSMTPservers + "/" + smtp); 1214 var values = { 1215 smtp: null, 1216 label: null, 1217 hostname: null, 1218 username: null 1219 } 1220 values.label = this._rdfImportDataSource._getRDFValue(resource, "label"); 1221 values.hostname = this._rdfImportDataSource._getRDFValue(resource, "hostname"); 1222 values.username = this._rdfImportDataSource._getRDFValue(resource, "username"); 1223 values.smtp = this._getMatchingSMTP(values.label, values.hostname, values.username); 1224 values.smtp = values.smtp ? values.smtp : "import_" + smtp; 1225 relevantSMTPs[smtp] = values; 1226 Log.debug("import: translate relevant SMTP from previous '" + smtp + "' to current '" + relevantSMTPs[smtp].smtp + "'"); 1227 } 1228 return relevantSMTPs; 1229 }, 1230 1231 _storeMappedSMTPs: function (relevantSMTPs) { 1232 for (var smtp in relevantSMTPs) { 1233 if (relevantSMTPs[smtp].smtp == "import_" + smtp) { 1234 var resource = this._rdfService 1235 .GetResource(this._rdfDataSource._rdfNS + this._rdfDataSource._rdfNSSMTPservers + "/" + relevantSMTPs[smtp].smtp); 1236 this._rdfDataSource._setRDFValue(resource, "label", relevantSMTPs[smtp].label); 1237 this._rdfDataSource._setRDFValue(resource, "hostname", relevantSMTPs[smtp].hostname); 1238 this._rdfDataSource._setRDFValue(resource, "username", relevantSMTPs[smtp].username); 1239 1240 var position = this._rdfDataSource._smtpContainer.IndexOf(resource); // check for index in new recType 1241 if (position != -1) this._rdfDataSource._smtpContainer.InsertElementAt(resource, position, false); 1242 else this._rdfDataSource._smtpContainer.AppendElement(resource); 1243 } 1244 } 1245 }, 1246 1066 //-------------------------------------------------------------------------------------------------------- 1067 //only required for update from pre 0.10 versions 1068 _rdfNSSMTPservers: "vIAccounts/smtp", 1069 1070 _getSMTPIDCombinations: function () { 1071 var SMTPIDCombinations = new Object(); 1072 var AccountManager = Components.classes["@mozilla.org/messenger/account-manager;1"] 1073 .getService(Components.interfaces.nsIMsgAccountManager); 1074 // search relevant SMTPs 1075 for (let treeType of Array("email", "maillist", "newsgroup", "filter")) { 1076 var enumerator = this._rdfImportDataSource.getContainer(treeType).GetElements(); 1077 while (enumerator && enumerator.hasMoreElements()) { 1078 var resource = enumerator.getNext(); 1079 resource.QueryInterface(Components.interfaces.nsIRDFResource); 1080 var smtp = this._rdfImportDataSource._getRDFValue(resource, "smtp") 1081 if (smtp) { 1082 var id = this._rdfImportDataSource._getRDFValue(resource, "id") 1083 if (id) { 1084 if (!SMTPIDCombinations[smtp + "-" + id]) SMTPIDCombinations[smtp + "-" + id] = 1; 1085 else SMTPIDCombinations[smtp + "-" + id] += 1; 1086 } 1087 } 1088 } 1089 } 1090 return SMTPIDCombinations; 1091 }, 1092 1093 _searchSmtpIdMismatch: function () { 1094 Log.debug("searchSmtpIdMismatch (only relevant for pre-0.10 rdf files)"); 1095 var AccountManager = Components.classes["@mozilla.org/messenger/account-manager;1"] 1096 .getService(Components.interfaces.nsIMsgAccountManager); 1097 1098 var relevantSMTPs = this._getSMTPIDCombinations(); 1099 var SMTPIDCombinations = []; 1100 1101 for (var smtpid in relevantSMTPs) { 1102 var smtp = smtpid.split("-")[0]; 1103 var id = smtpid.split("-")[1]; 1104 1105 Log.debug("search combination smtp=" + smtp + " id=" + id + " smtp(id)=" + AccountManager.getIdentity(id).smtpServerKey); 1106 1107 var id_smtp = AccountManager.getIdentity(id).smtpServerKey; 1108 if (!id_smtp) 1109 id_smtp = MailServices.smtp.defaultServer.key 1110 1111 if (smtp == id_smtp) 1112 break; 1113 1114 var resource = this._rdfImportDataSource._rdfService.GetResource(this._rdfImportDataSource._rdfNS + this._rdfNSSMTPservers + "/" + smtp); 1115 var rdfSMTPlabel = this._rdfImportDataSource._getRDFValue(resource, "label"); 1116 1117 var servers = MailServices.smtp.servers; 1118 1119 var smtpName; 1120 while (servers && servers.hasMoreElements()) { 1121 var server = servers.getNext(); 1122 if (server instanceof Components.interfaces.nsISmtpServer && 1123 !server.redirectorType && id_smtp == server.key) { 1124 smtpName = server.description ? server.description : server.hostname; 1125 break; 1126 } 1127 } 1128 1129 SMTPIDCombinations.push({ 1130 oldkey: smtpid, 1131 label: rdfSMTPlabel + " / ", 1132 ext1: AccountManager.getIdentity(id).identityName, 1133 ext2: "(" + smtpName + ")", 1134 count: relevantSMTPs[smtpid], 1135 key: "" 1136 }) 1137 } 1138 if (SMTPIDCombinations.length > 0) { 1139 Log.debug(" found mismatches on smtpid(s)."); 1140 get3PaneWindow().openDialog("chrome://v_identity/content/vI_rdfAccountMismatchDialog.xul", 0, 1141 "chrome, dialog, modal, alwaysRaised, resizable=yes", "smtpid", SMTPIDCombinations, 1142 /* callback: */ 1143 this._rdfImportDataSource).focus(); 1144 return true; 1145 } else { 1146 Log.debug(" found no mismatch"); 1147 return false; 1148 } 1149 }, 1150 //-------------------------------------------------------------------------------------------------------- 1151 1247 1152 import: function () { 1248 1153 var filePicker = Components.classes["@mozilla.org/filepicker;1"] … … 1253 1158 filePicker.appendFilters(Components.interfaces.nsIFilePicker.filterText | Components.interfaces.nsIFilePicker.filterAll); 1254 1159 1255 if (this._pickerShow(filePicker) == Components.interfaces.nsIFilePicker.returnOK) { 1256 Log.debug("import: preparation:"); 1257 1258 var importRdfDataFile = Components.classes["@mozilla.org/file/local;1"] 1259 .createInstance(Components.interfaces.nsIFile); 1260 var file = Components.classes["@mozilla.org/file/directory_service;1"] 1261 .getService(Components.interfaces.nsIProperties).get("ProfD", Components.interfaces.nsIFile); 1262 1263 initWithFilePath_tryDelimiters(importRdfDataFile, file.path, this._rdfFileName + "_import"); 1264 filePicker.file.copyTo(importRdfDataFile.parent, importRdfDataFile.leafName); 1265 1266 Log.debug("import: copied file from " + filePicker.file.path + " to " + importRdfDataFile.path + "'"); 1267 1268 // init Datasources 1160 if (this._pickerShow(filePicker) == Components.interfaces.nsIFilePicker.returnOK) 1161 this._importFile(filePicker.file); 1162 }, 1163 1164 importFileByName: function (fileName) { 1165 var newFile = Components.classes["@mozilla.org/file/local;1"] 1166 .createInstance(Components.interfaces.nsIFile); 1167 1168 var file = Components.classes["@mozilla.org/file/directory_service;1"] 1169 .getService(Components.interfaces.nsIProperties) 1170 .get("ProfD", Components.interfaces.nsIFile); 1171 1172 initWithFilePath_tryDelimiters(newFile, file.path, fileName); 1173 1174 this._importFile(newFile); 1175 }, 1176 1177 _importFile: function (file) { 1178 Log.debug("import: preparation:"); 1179 1180 var importRdfDataFile = Components.classes["@mozilla.org/file/local;1"] 1181 .createInstance(Components.interfaces.nsIFile); 1182 var tmpfile = Components.classes["@mozilla.org/file/directory_service;1"] 1183 .getService(Components.interfaces.nsIProperties).get("ProfD", Components.interfaces.nsIFile); 1184 1185 initWithFilePath_tryDelimiters(importRdfDataFile, tmpfile.path, this._rdfFileName + "_import"); 1186 file.copyTo(importRdfDataFile.parent, importRdfDataFile.leafName); 1187 1188 Log.debug("import: copied file from " + file.path + " to " + importRdfDataFile.path + "'"); 1189 1190 // init Datasources 1191 this._rdfImportDataSource = new rdfDatasource(this._currentWindow, importRdfDataFile.leafName, true); 1192 1193 // search matching IDs for anyones used in import-file 1194 var relevantIDs = this._translateRelevantIDs(); 1195 1196 // extension from version 0.10 on does not use any extra SMTP information anymore 1197 // and uses the SMTP-server from base identity instead. 1198 // check if any collisions between previously stored SMTP and base identity exists and solve this. 1199 Log.debug("import: search SMTP-ID mismatches"); 1200 this._searchSmtpIdMismatch(); 1201 1202 Log.debug("import: preparation done."); 1203 1204 for (let treeType of Array("email", "maillist", "newsgroup", "filter")) { 1205 // re-initialize importDataSource to point rdfService to the right Resources 1269 1206 this._rdfImportDataSource = new rdfDatasource(this._currentWindow, importRdfDataFile.leafName, true); 1270 1271 // search matching IDs and SMTPs for anyones used in import-file 1272 var relevantIDs = this._translateRelevantIDs(); 1273 var relevantSMTPs = this._translateRelevantSMTPs(); 1274 1275 Log.debug("import: preparation done."); 1276 1277 for (let treeType of Array("email", "maillist", "newsgroup", "filter")) { 1278 // re-initialize importDataSource to point rdfService to the right Resources 1279 this._rdfImportDataSource = new rdfDatasource(this._currentWindow, importRdfDataFile.leafName, true); 1280 var container = this._rdfImportDataSource.getContainer(treeType) 1281 if (container.GetCount() == 0) continue; 1282 Log.debug("importing " + treeType + ": " + container.GetCount() + " datasets from " + this._rdfImportDataSource._rdfDataSource.URI); 1283 var enumerator = container.GetElements(); 1284 // re-initialize dataSource to point rdfService to the right Resources 1285 this._rdfDataSource = new rdfDatasource(this._currentWindow, this._rdfFileName, true); 1286 var count = 0; 1287 while (enumerator.hasMoreElements()) { 1288 var resource = enumerator.getNext(); 1289 count += 1; 1290 resource.QueryInterface(Components.interfaces.nsIRDFResource); 1291 // Log.debug(" " + count + " "); 1292 var name = this._rdfImportDataSource._getRDFValue(resource, "name") 1293 var email = this._rdfImportDataSource._getRDFValue(resource, "email") 1294 var fullName = this._rdfImportDataSource._getRDFValue(resource, "fullName") 1295 var id = this._rdfImportDataSource._getRDFValue(resource, "id") 1296 id = id ? relevantIDs[id].id : null 1297 var smtp = this._rdfImportDataSource._getRDFValue(resource, "smtp") 1298 smtp = (smtp && smtp != DEFAULT_SMTP_TAG) ? relevantSMTPs[smtp].smtp : smtp 1299 var localIdentityData = new identityData(this._currentWindow, email, fullName, id, smtp, 1300 new identityDataExtras(this._currentWindow, this._rdfImportDataSource, resource)) 1301 1302 this._rdfDataSource.updateRDF(name, treeType, localIdentityData, false, false, null, null, true) 1303 var resource = this._rdfDataSource._getRDFResourceForVIdentity(name, treeType); 1304 if (id) this._rdfDataSource._setRDFValue(resource, "id", id); // localIdentityData can only store valid id's, this one might be a temporary invalid id 1305 if (smtp) this._rdfDataSource._setRDFValue(resource, "smtp", smtp); // localIdentityData can only store valid smtp's, this one might be a temporary invalid smtp 1306 } 1307 } 1308 1309 Log.debug("import: removing temporary file " + importRdfDataFile.path); 1310 this._rdfImportDataSource = null; 1311 importRdfDataFile.remove(false); 1312 Log.debug("import: import done."); 1313 1314 Log.debug("import: cleaning ID/SMTP storages:"); 1207 var container = this._rdfImportDataSource.getContainer(treeType) 1208 if (container.GetCount() == 0) continue; 1209 Log.debug("importing " + treeType + ": " + container.GetCount() + " datasets from " + this._rdfImportDataSource._rdfDataSource.URI); 1210 var enumerator = container.GetElements(); 1211 // re-initialize dataSource to point rdfService to the right Resources 1315 1212 this._rdfDataSource = new rdfDatasource(this._currentWindow, this._rdfFileName, true); 1316 1317 this._storeMappedIDs(relevantIDs); 1318 this._rdfDataSource.searchIdentityMismatch(); 1319 this._storeMappedSMTPs(relevantSMTPs); 1320 this._rdfDataSource.searchSmtpMismatch(); 1321 1322 this._rdfDataSource.refreshAccountInfo(); 1323 this._rdfDataSource.clean(); 1324 this._rdfDataSource = null; 1325 Log.debug("import: cleaning ID/SMTP storages done."); 1326 Log.debug("IMPORT DONE."); 1327 } 1213 var count = 0; 1214 while (enumerator.hasMoreElements()) { 1215 var resource = enumerator.getNext(); 1216 count += 1; 1217 resource.QueryInterface(Components.interfaces.nsIRDFResource); 1218 // Log.debug(" " + count + " "); 1219 var name = this._rdfImportDataSource._getRDFValue(resource, "name") 1220 var email = this._rdfImportDataSource._getRDFValue(resource, "email") 1221 var fullName = this._rdfImportDataSource._getRDFValue(resource, "fullName") 1222 var id = this._rdfImportDataSource._getRDFValue(resource, "id") 1223 id = id ? relevantIDs[id].id : null 1224 var localIdentityData = new identityData(this._currentWindow, email, fullName, id, 1225 new identityDataExtras(this._currentWindow, this._rdfImportDataSource, resource)) 1226 1227 this._rdfDataSource.updateRDF(name, treeType, localIdentityData, false, null, null, true) 1228 var resource = this._rdfDataSource._getRDFResourceForVIdentity(name, treeType); 1229 if (id) this._rdfDataSource._setRDFValue(resource, "id", id); // localIdentityData can only store valid id's, this one might be a temporary invalid id 1230 } 1231 } 1232 1233 Log.debug("import: removing temporary file " + importRdfDataFile.path); 1234 this._rdfImportDataSource = null; 1235 importRdfDataFile.remove(false); 1236 Log.debug("import: import done."); 1237 1238 Log.debug("import: cleaning ID storages:"); 1239 this._rdfDataSource = new rdfDatasource(this._currentWindow, this._rdfFileName, true); 1240 1241 this._storeMappedIDs(relevantIDs); 1242 this._rdfDataSource.searchIdentityMismatch(); 1243 1244 this._rdfDataSource.refreshAccountInfo(); 1245 this._rdfDataSource.clean(); 1246 this._rdfDataSource = null; 1247 Log.debug("import: cleaning ID storages done."); 1248 Log.debug("IMPORT DONE."); 1328 1249 }, 1329 1250 -
modules/vI_smartIdentity.js
rbc6c6b r85fa10 58 58 var msgHdr; 59 59 var msgComposeTypeReference = Components.interfaces.nsIMsgCompType; 60 Log.debug("this._document.title=" + this._document.title + " this._msgCompose=" + this._msgCompose + " msgIdentityClone=" + this._document.getElementById("msgIdentity"))60 Log.debug("this._document.title=" + this._document.title) 61 61 62 62 var newsgroup = this._msgCompose.compFields.newsgroups; … … 156 156 ((this._smartIdentityCollection._allIdentities.number == 1 && vIprefs.get("idSelection_ask_always")) || this._smartIdentityCollection._allIdentities.number > 1)) { 157 157 for (var index = 0; index < this._smartIdentityCollection._allIdentities.number; index++) { 158 Log.debug("smartIdentityReplyDialog index=" + index + ": '" + this._smartIdentityCollection._allIdentities.identityDataCollection[index].combinedName + "' " + "(" + this._smartIdentityCollection._allIdentities.identityDataCollection[index].id.value + " ," + this._smartIdentityCollection._allIdentities.identityDataCollection[index].smtp.value + ")");158 Log.debug("smartIdentityReplyDialog index=" + index + ": '" + this._smartIdentityCollection._allIdentities.identityDataCollection[index].combinedName + "' " + "(" + this._smartIdentityCollection._allIdentities.identityDataCollection[index].id.value + ")"); 159 159 } 160 160 this._currentWindow.openDialog("chrome://v_identity/content/vI_smartReplyDialog.xul", 0, … … 172 172 let allIdentities = self._smartIdentityCollection._allIdentities; 173 173 Log.debug("changeIdentityToSmartIdentity selectedValue=" + selectedValue + " from " + allIdentities.number); 174 Log.debug("changeIdentityToSmartIdentity selectedValue=" + selectedValue + ": '" + allIdentities.identityDataCollection[selectedValue].combinedName + "' " + "(" + allIdentities.identityDataCollection[selectedValue].id.value + " ," + allIdentities.identityDataCollection[selectedValue].smtp.value + ")");174 Log.debug("changeIdentityToSmartIdentity selectedValue=" + selectedValue + ": '" + allIdentities.identityDataCollection[selectedValue].combinedName + "' " + "(" + allIdentities.identityDataCollection[selectedValue].id.value + ")"); 175 175 176 176 // allIdentities.menuItems[selectedValue].setAttribute("accountkey", -
modules/vI_smartIdentityCollection.js
rbc6c6b r85fa10 95 95 96 96 var newIdentity = new identityData(this._currentWindow, new_email, 97 this._preselectedID.fullName, this._preselectedID.key, this._preselectedID.smtpServerKey,null, null)97 this._preselectedID.fullName, this._preselectedID.key, null, null) 98 98 99 99 this._allIdentities.addWithoutDuplicates(newIdentity); … … 160 160 for (var index = 0; index < number; index++) { 161 161 var newIdentity = new identityData(this._currentWindow, emails.value[index], fullNames.value[index], 162 null, NO_SMTP_TAG,null, null);162 null, null, null); 163 163 identityCollection.addWithoutDuplicates(newIdentity); 164 164 }
Note: See TracChangeset
for help on using the changeset viewer.