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

Changeset 85fa10


Ignore:
Timestamp:
Sep 9, 2018, 2:36:02 AM (4 years ago)
Author:
rene <rene@…>
Branches:
ng_0.9
Children:
c5860f
Parents:
bc6c6b
Message:

removed everything related to smtp-storage

Files:
2 deleted
20 edited

Legend:

Unmodified
Added
Removed
  • chrome.manifest

    rbc6c6b r85fa10  
    3131
    3232
    33 overlay chrome://messenger/content/am-smtp.xul          chrome://v_identity/content/accountManagerOverlays/vI_am-smtpOverlay.xul
    3433overlay chrome://messenger/content/AccountManager.xul   chrome://v_identity/content/accountManagerOverlays/vI_am-Overlay.xul
  • content/bindings/vI_rdfAccountMismatchDialog.xml

    rbc6c6b r85fa10  
    7474    <implementation>
    7575    <constructor>
    76         <![CDATA[       
     76        <![CDATA[
    7777        var menuitem = document.createElement("menuitem");
    7878        menuitem.setAttribute("class", "mismatchMenuitem");
     
    9595        if (oldval) {
    9696        oldval.removeAttribute('selected');
    97         if (document instanceof Components.interfaces.nsIDOMXULDocument) {
     97        if (ChromeUtils.getClassName(document) == "XULDocument") {
    9898            document.removeBroadcastListenerFor(oldval, this, "value");
    9999            document.removeBroadcastListenerFor(oldval, this, "label");
     
    116116        // DOMAttrModified listeners slow down setAttribute calls within
    117117        // the document, see bug 395496
    118         if (document instanceof Components.interfaces.nsIDOMXULDocument) {
     118        if (ChromeUtils.getClassName(document) == "XULDocument") {
    119119            document.addBroadcastListenerFor(val, this, "value");
    120120            document.addBroadcastListenerFor(val, this, "label");
     
    156156        <body><![CDATA[
    157157        virtualIdentityExtension.Log.debug("rdfAccountMismatchDialog.xml mismatchID-menupopup: _addIdentities.");
     158        Components.utils.import("resource://v_identity/vI_accountUtils.js", virtualIdentityExtension);
    158159        var accounts = virtualIdentityExtension.getAccountsArray();
    159160        for (let acc = 0; acc < accounts.length; acc++) {
     
    174175        ]]></body>
    175176    </method>
    176     <method name="_addSmtp">
    177         <parameter name="server" />
     177    <method name="_addIdentitiesWithSmtp">
    178178        <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.");
    188211        ]]></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 menuitem
    196             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 smtpService
    209             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>
    217212    </method>
    218213    <constructor>
     
    221216        const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
    222217        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        ]]>
    226227    </constructor>
    227228    </implementation>
  • content/bindings/v_identity.xml

    rbc6c6b r85fa10  
    8383                    "<td class='image'><img src='chrome://v_identity/skin/vi-info.png' /></td>" +
    8484                    "<td class='identityTable'>" +
    85                         "<div class='name'>" + this.elem.identityData.combinedNameHtml + "</div>" + 
    86                         "<table><tbody>" + this.elem.identityData.getMatrix() + "</tbody></table>" +
     85                        "<div class='name'>" + this.elem.identityData.combinedNameHtml + "</div>" +
     86                                                "<table><tbody>" + this.elem.identityData.getMatrix() + "</tbody></table>" +
    8787                    "</td>" +
    8888                "</tr></table>"
     
    135135
    136136        this.description = this._identityDataStorage.sideDescription?this._identityDataStorage.sideDescription:"";
    137         this.smtp = this._identityDataStorage.smtp.value;
     137        this.smtp = this._identityDataStorage.id.smtpServerName;
     138
    138139        // virtualIdentityExtension.MyLog.debug("v_identity.xml fromPopupItem_clone constructor smtp='" + this.smtp + "'")
    139140        this.smtpStyle = "width:" + document.getElementById("virtualIdentityExtension_SmtpServerList").clientWidth + "px;";
    140         this._identityDataStorage.smtp.value;
    141141       
    142142        document.getElementById("virtualIdentityExtension_tooltipPopupset").addTooltip(this, true);
     
    164164    </implementation>
    165165    </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 smtpService
    237             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.childNodes
    247             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 set
    259         virtualIdentityExtension.MyLog.debug("v_identity.xml smtp set to '" + val + "'")
    260         var MenuItems = this._smtpPopup.childNodes
    261         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    
    277166   
    278167    <binding id="fromMenuList_new" extends="chrome://global/content/bindings/menulist.xml#menulist-editable">
     
    306195                </xul:hbox>
    307196              </xul:moz-input-box>
    308               <!--<xul:hbox oncommand="event.stopPropagation();document.getBindingParent(this).smtp = this.smtp" xbl:inherits="showSmtp" anonid="smtpServerListHbox" class="smtpServerListHbox" />-->
    309197              <xul:dropmarker class="menulist-dropmarker" type="menu" xbl:inherits="open,disabled,parentfocused=focused"/>
    310198              <xul:popupset id="virtualIdentityExtension_tooltipPopupset" />
     
    324212        // it will be done in v_identity.js init
    325213        // document.getElementById("virtualIdentityExtension_tooltipPopupset").addTooltip(this, false);
    326        
    327         virtualIdentityExtension.vIprefs.addObserver("show_smtp", this.observe, this);
    328                 this.observe(this);
    329214        ]]>
    330215    </constructor>
     
    333218        var tooltipPopupset = document.getElementById("virtualIdentityExtension_tooltipPopupset")
    334219        if (tooltipPopupset) tooltipPopupset.removeTooltip(this.tooltipElem.getAttribute("tooltip"));
    335         virtualIdentityExtension.vIprefs.removeObserver("show_smtp", this.observe);
    336220        ]]>
    337221          </destructor>
     
    438322        ]]></body>
    439323    </method>
    440         <property name="smtp" onget="return this.identityData.smtp.key;" > // used to detect changes from SMTP-Menu
    441         <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>
    450324    <property name="identityData">
    451325        <getter><![CDATA[
     
    470344    <field name="tooltipElem">document.getAnonymousElementByAttribute(this, "anonid", "inputBox")</field>
    471345    <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>
    487346    <property name="email" onset="this.identityData.email = val; this.label = this.identityData.combinedName; this.inputEvent()" />
    488347    <property name="vid" onget="return (this.getAttribute('vid') == 'true');" onset="this.setAttribute('vid',val); return val;" />
     
    490349    <property name="extras" onget="return this.identityData.extras;" />
    491350    <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;" />-->
    493351    </implementation>
    494352    </binding>
     
    522380              this.identityData = new virtualIdentityExtension.identityData(window, identity.email,
    523381                                    identity.fullName, identity.key,
    524                                     identity.smtpServerKey, null, null, true);
     382                                    null, null, true);
    525383              this._identityData.extras.readIdentityValues(identity);
    526384              }
     
    550408            this._setAttributeIfNotEmpty("label", this._identityData.combinedName);
    551409            this._setAttributeIfNotEmpty("value", this._identityData.combinedName);
    552             this._setAttributeIfNotEmpty("smtp", this._identityData.smtp.value);
     410            this._setAttributeIfNotEmpty("smtp", this._identityData.id.smtpServerName);
    553411            this._setAttributeIfNotEmpty("description", "");
    554412           
  • content/prefDialog/vI_prefDialog.js

    rbc6c6b r85fa10  
    131131          "VIdent_identity.smart_reply_for_newsgroups",
    132132          "VIdent_identity.show_status",
    133           "VIdent_identity.show_smtp",
    134133          "VIdent_identity.fcc_show_switch",
    135134          "VIdent_identity.menu_entry",
     
    157156          "VIdent_identity.storage_store",
    158157          "VIdent_identity.storage_store_base_id",
    159           "VIdent_identity.storage_store_SMTP",
    160158          "VIdent_identity.storage_dont_update_multiple",
    161159          "VIdent_identity.storage_show_switch",
    162160          "VIdent_identity.storage_show_baseID_switch",
    163           "VIdent_identity.storage_show_SMTP_switch",
    164161          "VIdent_identity.storage_colorIndication",
    165162          "VIdent_identity.storage_warn_update",
     
    324321          mAttr("VIdent_identity.storage_store", "disabled", element.checked);
    325322          mAttr("VIdent_identity.storage_store_base_id", "disabled", element.checked);
    326           mAttr("VIdent_identity.storage_store_SMTP", "disabled", element.checked);
    327323          mAttr("VIdent_identity.storage_dont_update_multiple", "disabled", element.checked);
    328324          mAttr("VIdent_identity.storage_show_switch", "disabled", element.checked);
    329325          mAttr("VIdent_identity.storage_show_baseID_switch", "disabled", element.checked);
    330           mAttr("VIdent_identity.storage_show_SMTP_switch", "disabled", element.checked);
    331326          mAttr("VIdent_identity.storage_colorIndication", "disabled", element.checked);
    332327          mAttr("VIdent_identity.storage_warn_update", "disabled", element.checked);
  • content/prefDialog/vI_prefDialog.xul

    rbc6c6b r85fa10  
    363363                    <checkbox id="VIdent_identity.show_status" label="&vI_prefDialog.composeDialog.status.label;"
    364364                        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" />
    367365                    <checkbox id="VIdent_identity.fcc_show_switch" label="&vI_prefDialog.composeDialog.fcc_show_switch.label;"
    368366                        tooltiptext="&vI_prefDialog.composeDialog.fcc_show_switch.tooltiptext;" prefstring="fcc_show_switch" />
     
    376374                    <checkbox id="VIdent_identity.storage_show_baseID_switch" label="&vI_prefDialog.composeDialog.show_baseID_switch.label;"
    377375                        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"/>
    380376                </groupbox>
    381377            </tabpanel>
     
    586582                    oncommand="virtualIdentityExtension.prefDialog.base.storageConstraint(this);" />
    587583                <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')" />
    590586                </groupbox>
    591587                <groupbox>
     
    620616                    <checkbox id="VIdent_identity.storage_store_base_id" label="&vI_prefDialog.storage.store_base_id.label;"
    621617                        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"/>
    624618                    <checkbox id="VIdent_identity.storage_warn_update" label="&vI_prefDialog.storage.warn_update.label;"
    625619                        prefstring="storage_warn_update"/>
  • content/vI_rdfAccountMismatchDialog.js

    rbc6c6b r85fa10  
    6060        }
    6161        /* window.argument[2] stores callback parent */
    62         window.arguments[2].repairAccountMismatch(rdfAccountMismatchDialog.type, rdfAccountMismatchDialog.mismatchItems);
     62        window.arguments[2].repairMismatch(rdfAccountMismatchDialog.type, rdfAccountMismatchDialog.mismatchItems);
    6363      }
    6464    }
  • content/vI_rdfAccountMismatchDialog.xul

    rbc6c6b r85fa10  
    4545            <description class="widthXX">&vident.virtualIdentityExtension_rdfAccountMismatchDialog_identity.desc;</description>
    4646        </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>
    5050        </vbox>
    5151        <listbox id="virtualIdentityExtension_rdfAccountMismatchDialog_listbox" suppressonselect="true" rows="5" >
     
    5555            <listheader label="&vident.virtualIdentityExtension_rdfAccountMismatchDialog_identity.new;" />
    5656        </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;" />
    6161        </listhead>
    6262        <listcols><listcol/><listcol/><listcol/></listcols>
  • content/vI_rdfDataEditor.js

    rbc6c6b r85fa10  
    9090        }
    9191
    92         // set SMTP
    93         document.getElementById("virtualIdentityExtension_smtpServerListHbox").addNoneServer(); // add non (not stored) Server
    94         document.getElementById("virtualIdentityExtension_smtpServerListHbox").smtp = rdfDataEditor.__identityData.smtp.keyNice;
    95 
    9692        // set extra values
    9793        rdfDataEditor.__identityData.extras.setValuesToEnvironment();
     
    145141        var localIdentityData = new vI.identityData(window, document.getElementById("sender").value, null,
    146142          document.getElementById("virtualIdentityExtension_IdentityList").selectedItem.getAttribute("identitykey"),
    147           document.getElementById("virtualIdentityExtension_SmtpServerList").selectedItem.getAttribute("key"));
    148143        localIdentityData.extras.getValuesFromEnvironment();
    149144        rdfDataEditor.__rdfDatasource.updateRDF(
     
    151146          document.getElementById("type_menu").selectedItem.getAttribute("key"),
    152147          localIdentityData,
    153           true, true, rdfDataEditor.__recipient, rdfDataEditor.__type, true);
     148          true, rdfDataEditor.__recipient, rdfDataEditor.__type, true);
    154149        Log.debug("updateRDF done " + localIdentityData.extras.status());
    155150        return document.getElementById("type_menu").selectedItem.getAttribute("key");
  • content/vI_rdfDataEditor.xul

    rbc6c6b r85fa10  
    6262        <hbox>
    6363            <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"/>
    7064                <label value="&vI_rdfDataEditor.identity.label;" accesskey="&vI_rdfDataEditor.identity.accesskey;" control="virtualIdentityExtension_IdentityList"/>
    7165            <spacer flex="1"/></vbox>
  • content/vI_rdfDataTree.js

    rbc6c6b r85fa10  
    134134            indexCol: idData.length + 1 + ".",
    135135            senderCol: localIdentityData.combinedName,
    136             smtpCol: localIdentityData.smtp.value,
    137             //              smtpKey : localIdentityData.smtp.key,
    138136            idCol: localIdentityData.id.value,
    139137            usedCol: usedDate,
     
    244242          .createBundle("chrome://v_identity/locale/vI_rdfDataEditor.properties");
    245243
    246         rdfDataTreeCollection._rdfDatasource = new vI.rdfDatasource(window, "virtualIdentity.rdf");
     244        rdfDataTreeCollection._rdfDatasource = new vI.rdfDatasource(window, "virtualIdentity_0.10.rdf");
    247245
    248246        for (var treeType of rdfDataTreeCollection.treeTypes)
     
    513511        var treeType = rdfDataTreeCollection.tabbox.selectedPanel.id;
    514512        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)
    516514        };
    517515        var retVar = {
  • content/vI_rdfDataTree.xul

    rbc6c6b r85fa10  
    114114        <menu id="tasksMenu" label="&tasksMenu.label;" accesskey="&tasksMenu.accesskey;">
    115115        <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')"/>
    118118        </menupopup>
    119119        </menu>
     
    149149            persist="hidden width ordinal sortDirection"/>
    150150        <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" />
    155151        <treecol id="idCol_email" label="&vI_rdfDataTree.idColumn.label;" flex="10"
    156152            class="sortDirectionIndicator"
     
    194190            persist="hidden width ordinal sortDirection"/>
    195191        <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" />
    200192        <treecol id="idCol_maillist" label="&vI_rdfDataTree.idColumn.label;" flex="10"
    201193            class="sortDirectionIndicator"
     
    238230            persist="hidden width ordinal sortDirection"/>
    239231        <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" />
    244232        <treecol id="idCol_newsgroup" label="&vI_rdfDataTree.idColumn.label;" flex="10"
    245233            class="sortDirectionIndicator"
     
    287275            persist="hidden width ordinal"/>
    288276        <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" />
    293277        <treecol id="idCol_filter" label="&vI_rdfDataTree.idColumn.label;" flex="10"
    294278            class="sortDirectionIndicator"
  • content/vI_smartReplyDialog.js

    rbc6c6b r85fa10  
    3939
    4040          var id = null;
    41           var smtp = null;
    42 
    4341          if (smartReply_dialog.all_addresses.identityDataCollection[index].id)
    4442            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;
    4743
    4844          let defaultServerTag = Components.classes["@mozilla.org/intl/stringbundle;1"]
     
    5147            .GetStringFromName("defaultServerTag")
    5248
    53           menuentry += (id ? " (" + id + "," + (smtp ? smtp : defaultServerTag) + ")" : "")
     49          menuentry += (id ? " (" + id + ")" : "")
    5450          smartReply_dialog.add_row(menuentry);
    5551        }
  • content/vI_statusmenu.js

    rbc6c6b r85fa10  
    4242//       objSaveSwitch: null,
    4343//       objSaveBaseIDSwitch: null,
    44 //       objSaveSMTPSwitch: null,
    4544//       objFccSwitch: null,
    4645      objStatusText: null,
     
    6665//           statusmenu.objSaveBaseIDSwitch.setAttribute("hidden", !vI.vIprefs.get(data));
    6766//           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;
    7267        case "storage_store":
    7368          statusmenu.objStorageSaveMenuItem.setAttribute("checked", vI.vIprefs.get(data));
     
    7570        case "storage_store_base_id":
    7671          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");
    8272          break;
    8373        case "storage_colorIndication":
    8474          document.getElementById("identityHbox").setAttribute("colorize", vI.vIprefs.get(data))
    8575          document.getElementById("baseIDHbox").setAttribute("colorize", vI.vIprefs.get(data))
    86 //           document.getElementById("smtpServerHbox").setAttribute("colorize", vI.vIprefs.get(data))
    8776          break;
    8877        case "storage":
     
    9079            statusmenu.objStorageSaveMenuItem.removeAttribute("hidden");
    9180            statusmenu.objSaveBaseIDMenuItem.removeAttribute("hidden");
    92 //             statusmenu.objSaveSMTPMenuItem.removeAttribute("hidden");
    9381            statusmenu.objStatusMenuSeparator.removeAttribute("hidden");
    9482          } else {
    9583            statusmenu.objStorageSaveMenuItem.setAttribute("hidden", "true");
    9684            statusmenu.objSaveBaseIDMenuItem.setAttribute("hidden", "true");
    97 //             statusmenu.objSaveSMTPMenuItem.setAttribute("hidden", "true");
    9885            statusmenu.objStatusMenuSeparator.setAttribute("hidden", "true");
    9986          }
     
    11097//         vI.vIprefs.addObserver("storage_show_switch", this.observe, this);
    11198//         vI.vIprefs.addObserver("storage_show_baseID_switch", this.observe, this);
    112 //         vI.vIprefs.addObserver("storage_show_SMTP_switch", this.observe, this);
    11399        vI.vIprefs.addObserver("storage_colorIndication", this.observe, this);
    114100        vI.vIprefs.addObserver("storage_store", this.observe, this);
    115101        vI.vIprefs.addObserver("storage_store_base_id", this.observe, this);
    116 //         vI.vIprefs.addObserver("storage_store_SMTP", this.observe, this);
    117102      },
    118103
     
    124109//         vI.vIprefs.removeObserver("storage_show_switch", this.observe);
    125110//         vI.vIprefs.removeObserver("storage_show_baseID_switch", this.observe);
    126 //         vI.vIprefs.removeObserver("storage_show_SMTP_switch", this.observe);
    127111        vI.vIprefs.removeObserver("storage_colorIndication", this.observe);
    128112        vI.vIprefs.removeObserver("storage_store", this.observe);
    129113        vI.vIprefs.removeObserver("storage_store_base_id", this.observe);
    130 //         vI.vIprefs.removeObserver("storage_store_SMTP", this.observe);
    131114      },
    132115
     
    135118        statusmenu.objStatusLogo = document.getElementById("virtualIdentityExtension_Logo");
    136119        statusmenu.objSaveBaseIDMenuItem = document.getElementById("virtualIdentityExtension_statusMenu_storage_saveBaseID");
    137 //         statusmenu.objSaveSMTPMenuItem = document.getElementById("virtualIdentityExtension_statusMenu_storage_saveSMTP");
    138120        statusmenu.objStorageSaveMenuItem = document.getElementById("virtualIdentityExtension_statusMenu_storage_save");
    139121        statusmenu.objStatusMenuSeparator = document.getElementById("virtualIdentityExtension_statusMenu_separator");
    140122//         statusmenu.objSaveSwitch = document.getElementById("virtualIdentityExtension_saveSwitch");
    141123//         statusmenu.objSaveBaseIDSwitch = document.getElementById("virtualIdentityExtension_saveBaseIDSwitch");
    142 //         statusmenu.objSaveSMTPSwitch = document.getElementById("virtualIdentityExtension_SaveSmtpSwitch");
    143124//         statusmenu.objFccSwitch = document.getElementById("virtualIdentityExtension_fccSwitch");
    144125        statusmenu.objStatusText = document.getElementById("statusText");
     
    151132//         statusmenu.observe(this, null, null, "storage_show_switch");
    152133//         statusmenu.observe(this, null, null, "storage_show_baseID_switch");
    153 //         statusmenu.observe(this, null, null, "storage_show_SMTP_switch");
    154134        statusmenu.observe(this, null, null, "storage_colorIndication");
    155135        statusmenu.observe(this, null, null, "storage_store_base_id");
    156 //         statusmenu.observe(this, null, null, "storage_store_SMTP");
    157136        statusmenu.observe(this, null, null, "storage_store");
    158137        statusmenu.observe(this, null, null, "storage");
     
    160139
    161140      __timeout: 5, // timeout for status messages in seconds
    162       __addStatusMessage: function (save, smtp) {
     141      __addStatusMessage: function (save) {
    163142        if (vI.vIprefs.get("show_status")) {
    164143          var sourceString = "vident.statusText.save." + save;
    165           if (smtp != "off") sourceString = sourceString + ".smtp"
    166144          var messageLine1 = statusmenu.stringBundle.GetStringFromName(sourceString + ".line1");
    167145          var messageLine2 = statusmenu.stringBundle.GetStringFromName(sourceString + ".line2");
     
    184162      },
    185163
    186       changeSMTPStatus: function (elem) {
    187 //         statusmenu.objSaveSMTPMenuItem.setAttribute("checked", elem.getAttribute("checked"));
    188         statusmenu.menuConstraint();
    189       },
    190 
    191164      changeBaseIDStatus: function (elem) {
    192165        statusmenu.objSaveBaseIDMenuItem.setAttribute("checked", elem.getAttribute("checked"));
     
    201174      menuConstraint: function () {
    202175        var save = "off";
    203         var smtp = "off";
    204176        if (statusmenu.objStorageSaveMenuItem.getAttribute("checked") == "true") {
    205 //           statusmenu.objSaveSMTPMenuItem.removeAttribute("disabled");
    206177          statusmenu.objSaveBaseIDMenuItem.removeAttribute("disabled");
    207178          if (vI.vIprefs.get("storage")) {
    208179            if (statusmenu.objSaveBaseIDMenuItem.getAttribute("checked") == "true") save = "base";
    209180            else save = "ok";
    210 //             if (statusmenu.objSaveSMTPMenuItem.getAttribute("checked") == "true") smtp = "save";
    211181          }
    212182        } else {
    213 //           statusmenu.objSaveSMTPMenuItem.setAttribute("disabled", "true");
    214183          statusmenu.objSaveBaseIDMenuItem.setAttribute("disabled", "true");
    215184        }
    216185        statusmenu.objStatusMenu.setAttribute("save", save);
    217         statusmenu.objStatusMenu.setAttribute("smtp", smtp);
    218         statusmenu.__addStatusMessage(save, smtp);
     186        statusmenu.__addStatusMessage(save);
    219187      },
    220188
     
    224192
    225193        var curSaveStatus = vI.vIprefs.get("storage_store")
    226         var curSaveSMTPStatus = vI.vIprefs.get("storage_store_SMTP")
    227194        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)
    231197
    232198        vI.vIprefs.set("storage_store", newSaveStatus)
    233         vI.vIprefs.set("storage_store_SMTP", newSaveSMTPStatus)
    234199        vI.vIprefs.set("storage_store_base_id", newSaveBaseIDStatus)
    235200
  • content/v_identity.js

    rbc6c6b r85fa10  
    119119          // store identitykey locally to enable restoring after selection of next virtual identity without identitykey
    120120          identityElement.setAttribute("identitykey", identityElement.selectedItem.getAttribute("identitykey"));
    121          
    122           // we are not using the smtp display, smtp is selected based on base identity
    123           //dentityElement.setAttribute("smtp", identityElement.identityData.smtp.value);
    124121         
    125122          identityElement.vid = identityElement.selectedItem.vid;
     
    314311        _uninstall: false,
    315312        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           }
    321313          if (topic == "am-acceptChanges") {
    322314            Log.debug("account changes observed");
     
    348340          var obsService = Components.classes["@mozilla.org/observer-service;1"].
    349341          getService(Components.interfaces.nsIObserverService)
    350           obsService.addObserver(this, "am-smtpChanges", false);
    351342          obsService.addObserver(this, "am-acceptChanges", false);
    352343        },
     
    354345          var obsService = Components.classes["@mozilla.org/observer-service;1"].
    355346          getService(Components.interfaces.nsIObserverService)
    356           obsService.removeObserver(this, "am-smtpChanges");
    357347          obsService.removeObserver(this, "am-acceptChanges");
    358348        }
  • content/v_identity.xul

    rbc6c6b r85fa10  
    8686          <menuitem type="checkbox" id="virtualIdentityExtension_statusMenu_storage_saveBaseID" label="&vident.vI_Menu.saveBaseID.label;"
    8787            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'));"/>-->
    9088          <menuseparator id="virtualIdentityExtension_statusMenu_separator" />
    9189          <menuitem class="menuitem-iconic" label="&vident.vI_Menu.Settings.label;"
  • defaults/preferences/preferences.js

    rbc6c6b r85fa10  
    1010pref("extensions.virtualIdentity.copyAttachVCardSettings", false);
    1111pref("extensions.virtualIdentity.copyNewEnigmailSettings", true);
    12 pref("extensions.virtualIdentity.show_smtp", false);
    1312pref("extensions.virtualIdentity.show_status", true);
    1413pref("extensions.virtualIdentity.fcc_show_switch", false);
     
    4342pref("extensions.virtualIdentity.storage_store", true);
    4443pref("extensions.virtualIdentity.storage_store_base_id", false);
    45 pref("extensions.virtualIdentity.storage_store_SMTP", false);
    4644pref("extensions.virtualIdentity.storage_dont_update_multiple", true);
    4745pref("extensions.virtualIdentity.storage_show_switch", false);
    4846pref("extensions.virtualIdentity.storage_show_baseID_switch", false);
    49 pref("extensions.virtualIdentity.storage_show_SMTP_switch", false);
    5047pref("extensions.virtualIdentity.storage_colorIndication", true);
    5148pref("extensions.virtualIdentity.storage_warn_update", true);
  • modules/vI_identityData.js

    rbc6c6b r85fa10  
    4444Components.utils.import("resource://v_identity/identityDataExtras/PGPMIME.js");
    4545
    46 function identityData(currentWindow, email, fullName, id, smtp, extras, sideDescription, existingID) {
     46ChromeUtils.import("resource:///modules/mailServices.js");
     47
     48function identityData(currentWindow, email, fullName, id, extras, sideDescription, existingID) {
    4749  this._currentWindow = currentWindow;
    4850  this._email = email ? email : "";
     
    5052  this._fullName = fullName ? fullName : "";
    5153  this.id = new idObj(id);
    52   this.smtp = new smtpObj(smtp);
    5354  if (extras) this.extras = extras;
    5455  else this.extras = new identityDataExtras(currentWindow);
     
    5859      fullName: {},
    5960      email: {},
    60       smtp: {},
    6161      id: {},
    6262      extras: {}
     
    7676  _currentWindow: null,
    7777  id: null,
    78   smtp: null,
    7978  extras: null,
    8079  sideDescription: null,
     
    139138    return this.__makeHtml(this.id.value);
    140139  },
    141   get smtpHtml() {
    142     return this.__makeHtml(this.smtp.value);
    143   },
    144140  get fullNameHtml() {
    145141    return this.__makeHtml(this.fullName);
     
    155151    return this.stringBundle.GetStringFromName("vident.identityData.baseID")
    156152  },
    157   get smtpLabel() {
    158     return this.stringBundle.GetStringFromName("vident.identityData.SMTP")
    159   },
    160153  get fullNameLabel() {
    161154    return this.stringBundle.GetStringFromName("vident.identityData.Name")
     
    167160  // creates an Duplicate of the current IdentityData, cause usually we are working with a pointer
    168161  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,
    170163      this.sideDescription, this.existingID);
    171164  },
     
    178171    if (identityData.id.key)
    179172      this.id.key = identityData.id.key;
    180     if (identityData.smtp.key)
    181       this.smtp.key = identityData.smtp.key;
    182173    if (identityData.sideDescription)
    183174      this.sideDescription = identityData.sideDescription;
     
    191182    this.fullName = identityData.fullName;
    192183    this.id.key = identityData.id.key;
    193     this.smtp.key = identityData.smtp.key;
    194184    this.sideDescription = identityData.sideDescription;
    195185    if (this.extras) this.extras.copy(identityData.extras);
     
    200190  isExistingIdentity: function (ignoreFullNameWhileComparing) {
    201191    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 + "'");
    203193
    204194    var ignoreFullNameMatchKey = null;
     
    213203      for (let i = 0; i < identities.length; i++) {
    214204        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() + "'");
    216206        var email = this.email ? this.email : ""; // might be null if no identity is set
    217207        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()) {
    220209          // if fullName matches, than this is a final match
    221210          if (this.fullName.toLowerCase() == identity.fullName.toLowerCase()) {
     
    288277    }
    289278
    290     this.comp.equals.smtp = this.smtp.equal(compareIdentityData.smtp);
    291279    this.comp.equals.id = this.id.equal(compareIdentityData.id);
    292280    this.comp.equals.extras = this.extras ? this.extras.equal(compareIdentityData.extras) : true;
    293281
    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);
    295283  },
    296284
     
    307295
    308296  getCompareMatrix: function () {
    309     const Items = Array("fullName", "email", "smtp", "id");
     297    const Items = Array("fullName", "email", "id");
    310298    var string = "";
    311299    var saveBaseId = vIprefs.get("storage_store_base_id");
    312     var saveSMTP = vIprefs.get("storage_store_SMTP");
    313300    for (let item of Items) {
    314301      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" : ""
    316303      string += "<tr>" +
    317304        "<td class='col1 " + classEqual + "'>" + this[item + "Label"] + "</td>" +
     
    325312
    326313  getMatrix: function () {
    327     const Items = Array("smtp", "id");
    328314    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>"
    332318    string += this.extras ? this.extras.getMatrix() : "";
    333319    return string;
     
    363349      if (this.identityDataCollection[index].email == identityData.email &&
    364350        (!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)) {
    367352        // found, so check if we can use the Name of the new field
    368353        if (this.identityDataCollection[index].fullName == "" && identityData.fullName != "") {
     
    370355          Log.debug("added fullName '" + identityData.fullName + "' to stored email '" + this.identityDataCollection[index].email + "'")
    371356        }
    372         // check if id_key, smtp_key or extras can be used
     357        // check if id_key or extras can be used
    373358        // only try this once, for the first Identity where id is set)
    374359        if (!this.identityDataCollection[index].id.key && identityData.id.key) {
    375360          this.identityDataCollection[index].id.key = identityData.id.key;
    376           this.identityDataCollection[index].smtp.key = identityData.smtp.key;
    377361          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 + "'")
    379363        }
    380364        return;
     
    393377  }
    394378};
    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 available
    414     return this._key
    415   },
    416   get keyNice() { // the same as key but with "" for DEFAULT_SMTP_TAG
    417     if (this.key == DEFAULT_SMTP_TAG) return ""; // this is the key used for default server
    418     return this.key
    419   },
    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 smtpService
    430         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 available
    444     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 }
    457379
    458380function idObj(key) {
     
    502424    return this._value;
    503425  },
     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 
    504460  equal: function (compareIdObj) {
    505461    if (!this.key || !compareIdObj.key) return true;
  • modules/vI_rdfDatasource.js

    rbc6c6b r85fa10  
    3232Components.utils.import("resource://v_identity/vI_identityData.js");
    3333Components.utils.import("resource://gre/modules/Services.jsm");
     34
     35ChromeUtils.import("resource:///modules/mailServices.js");
    3436
    3537// if no 3pane-window found, return current window
     
    6870  this._currentWindow = currentWindow;
    6971  this._rdfFileName = rdfFileName;
     72  this._dontRegisterObserver = dontRegisterObserver;
    7073  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 + "'");
    7577}
    7678
     
    7880  _currentWindow: null,
    7981  _extVersion: null,
    80   _rdfVersion: "0.0.5",
     82  _rdfVersion: "0.0.6",
    8183  _rdfService: Components.classes["@mozilla.org/rdf/rdf-service;1"]
    8284    .getService(Components.interfaces.nsIRDFService),
     
    9193  _rdfNSAccounts: "vIAccounts",
    9294  _rdfNSIdentities: "vIAccounts/id",
    93   _rdfNSSMTPservers: "vIAccounts/smtp",
    9495
    9596  _virtualIdentityID: "{dddd428e-5ac8-4a81-9f78-276c734f75b8}",
    9697
     98  _dontRegisterObserver: false,
     99 
    97100  _emailContainer: Components.classes["@mozilla.org/rdf/container;1"]
    98101    .createInstance(Components.interfaces.nsIRDFContainer),
     
    108111
    109112  _identityContainer: Components.classes["@mozilla.org/rdf/container;1"]
    110     .createInstance(Components.interfaces.nsIRDFContainer),
    111 
    112   _smtpContainer: Components.classes["@mozilla.org/rdf/container;1"]
    113113    .createInstance(Components.interfaces.nsIRDFContainer),
    114114
     
    125125    case "identity":
    126126      return this._identityContainer;
    127     case "smtp":
    128       return this._smtpContainer;
    129127    }
    130128    return null;
     
    187185        .GetResource(this._rdfNS + this._rdfNSIdentities);
    188186      this._identityContainer.Init(this._rdfDataSource, storageRes);
    189       storageRes = this._rdfService
    190         .GetResource(this._rdfNS + this._rdfNSSMTPservers);
    191       this._smtpContainer.Init(this._rdfDataSource, storageRes);
    192187    } catch (e) {};
    193188  },
     
    216211    switch (currentVersion) {
    217212    case null:
    218     case "0.0.1":
    219     case "0.0.2":
    220213      this._createRDFContainers(); // no break
    221     case "0.0.3":
    222       this._tagDefaultSMTP();
    223     case "0.0.4":
    224214    default:
    225215      this._createAccountInfoContainers();
     
    256246    }
    257247  },
    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
    272249  _createAccountInfoContainers: function () {
    273250    Log.debug("upgrade: createAccountInfoContainers");
     
    279256    var identityRes = this._rdfService
    280257      .GetResource(this._rdfNS + this._rdfNSIdentities);
    281     var smtpRes = this._rdfService
    282       .GetResource(this._rdfNS + this._rdfNSSMTPservers);
     258
    283259    this._setRDFValue(accountRes, "name", "Accounts");
    284260    this._setRDFValue(identityRes, "name", "Identities");
    285     this._setRDFValue(smtpRes, "name", "SMTP-Server");
    286261
    287262    rdfContainerUtils.MakeBag(this._rdfDataSource, accountRes);
    288263    rdfContainerUtils.MakeBag(this._rdfDataSource, identityRes);
    289     rdfContainerUtils.MakeBag(this._rdfDataSource, smtpRes);
    290264
    291265    var accountContainer = Components.classes["@mozilla.org/rdf/container;1"].
     
    296270    // append all new containers to accountRes
    297271    if (accountContainer.IndexOf(identityRes) == -1) accountContainer.AppendElement(identityRes);
    298     if (accountContainer.IndexOf(smtpRes) == -1) accountContainer.AppendElement(smtpRes);
    299272
    300273    this._initContainers();
     
    371344
    372345  clean: function () {
    373     this.AccountManagerObserver.unregister();
     346    if (!this._dontRegisterObserver) this.AccountManagerObserver.unregister();
    374347    this._flush();
    375348  },
     
    401374      this._unsetRDFValue(resource, "email", this._getRDFValue(resource, "email"))
    402375      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);
    413376    }
    414377  },
     
    482445  },
    483446
    484   repairAccountMismatch: function (type, mismatchItems) {
    485     var keyField = (type == "identity") ? "id" : "smtp" // field to change is 'id' or 'smtp' dependent on type
     447  repairMismatch: function (type, mismatchItems) {
     448    // type might be 'id' or 'smtpid' - dependent on trigger
    486449    for (var i = 0; i < mismatchItems.length; i++) {
    487450      Log.debug("repairAccountMismatch change " + mismatchItems[i].oldkey + " into " + mismatchItems[i].key);
     
    492455          var resource = enumerator.getNext();
    493456          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)
    497471          }
    498472        }
    499473      }
    500     }
    501   },
    502 
    503   getRelevantSMTPs: function () {
    504     var relevantSMTPs = new Object();
    505     // search relevant SMTPs
    506     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 smtpService
    531       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;
    567474    }
    568475  },
     
    588495      }
    589496    }
    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 recType
    598       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 smtpService
    605     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");
    614497  },
    615498
     
    679562    this._unsetRDFValue(resource, "fullName", this._getRDFValue(resource, "fullName"))
    680563    this._unsetRDFValue(resource, "id", this._getRDFValue(resource, "id"))
    681     this._unsetRDFValue(resource, "smtp", this._getRDFValue(resource, "smtp"))
    682564    this._unsetRDFValue(resource, "name", this._getRDFValue(resource, "name"))
    683565
     
    714596      var fullName = this._getRDFValue(resource, "fullName")
    715597      var id = this._getRDFValue(resource, "id")
    716       var smtp = this._getRDFValue(resource, "smtp")
    717598      var used = this._getRDFValue(resource, "timeUsed")
    718599      var changed = this._getRDFValue(resource, "timeChanged")
    719       if (!smtp) smtp = NO_SMTP_TAG;
    720600      let self = this;
    721       var localIdentityData = new identityData(this._currentWindow, email, fullName, id, smtp,
     601      var localIdentityData = new identityData(this._currentWindow, email, fullName, id,
    722602        new identityDataExtras(this._currentWindow, self, resource))
    723603      addNewDatum(resource, name, localIdentityData, idData, used, changed)
     
    739619    } else {
    740620      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);
    742622      return {
    743623        recDesc: localIdentityData.combinedName,
     
    847727    var fullName = this._getRDFValue(resource, "fullName")
    848728    var id = this._getRDFValue(resource, "id")
    849     var smtp = this._getRDFValue(resource, "smtp")
    850     if (!smtp) smtp = NO_SMTP_TAG;
    851729
    852730    let _date = new Date();
     
    854732
    855733    Log.debug("email='" + email +
    856       "' fullName='" + fullName + "' id='" + id + "' smtp='" + smtp + "'");
     734      "' fullName='" + fullName + "' id='" + id + "'");
    857735
    858736    let self = this;
    859     var localIdentityData = new identityData(this._currentWindow, email, fullName, id, smtp,
     737    var localIdentityData = new identityData(this._currentWindow, email, fullName, id,
    860738      new identityDataExtras(this._currentWindow, self, resource))
    861739    return localIdentityData;
     
    874752    this.updateRDF(recipient.recDesc, recipient.recType, identityData,
    875753      vIprefs.get("storage_store_base_id"),
    876       vIprefs.get("storage_store_SMTP"),
    877754      null, null, false);
    878755  },
     
    885762  },
    886763
    887   updateRDF: function (recDescription, recType, localIdentityData, storeBaseID, storeSMTP, prevRecDescription, prevRecType, updateAllExtras) {
     764  updateRDF: function (recDescription, recType, localIdentityData, storeBaseID, prevRecDescription, prevRecType, updateAllExtras) {
    888765    //         Log.debug("(" + this._rdfNS + "): updateRDF recDescription=" + recDescription + " localIdentityData.email=" + localIdentityData.email);
    889766
     
    911788      this._setRDFValue(resource, "id", localIdentityData.id.key);
    912789    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"))
    916790    this._setRDFValue(resource, "name", recDescription);
    917791
     
    953827    _uninstall: false,
    954828    observe: function (subject, topic, data) {
    955       if (topic == "am-smtpChanges" || topic == "am-acceptChanges") {
    956         Log.debug("account/smtp changes observed");
     829      if (topic == "am-acceptChanges") {
     830        Log.debug("account/identity changes observed");
    957831        this.self.searchIdentityMismatch();
    958         this.self.searchSmtpMismatch();
    959832        this.self.refreshAccountInfo();
    960833      }
     
    965838      var obsService = Components.classes["@mozilla.org/observer-service;1"].
    966839      getService(Components.interfaces.nsIObserverService)
    967       obsService.addObserver(this, "am-smtpChanges", false);
    968840      obsService.addObserver(this, "am-acceptChanges", false);
    969841    },
    970842    unregister: function () {
     843      Log.debug("unregister AccountManagerObserver");
    971844      var obsService = Components.classes["@mozilla.org/observer-service;1"].
    972845      getService(Components.interfaces.nsIObserverService)
    973846      try {
    974         obsService.removeObserver(this, "am-smtpChanges");
    975847        obsService.removeObserver(this, "am-acceptChanges");
    976848      } catch (e) {};
     
    982854function rdfDatasourceAccess(currentWindow) {
    983855  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);
    985857  this.stringBundle = Services.strings.createBundle("chrome://v_identity/locale/v_identity.properties");
    986858}
     
    11281000
    11291001// create with name of the file to import into
    1130 function rdfDatasourceImporter(currentWindow, rdfFileName) {
     1002function rdfDatasourceImporter(currentWindow, rdfFileName, importNow = true) {
    11311003  this._currentWindow = currentWindow;
    11321004  this._rdfFileName = rdfFileName;
    1133   if (this._rdfFileName) this.import();
     1005  if (importNow && this._rdfFileName) this.import();
    11341006}
    11351007
     
    11511023        if (name == identity.identityName || (fullName == identity.fullName && email == identity.email)) return identity.key;
    11521024      }
    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 smtpService
    1161     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;
    11691025    }
    11701026    return null;
     
    12081064  },
    12091065
    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 
    12471152  import: function () {
    12481153    var filePicker = Components.classes["@mozilla.org/filepicker;1"]
     
    12531158    filePicker.appendFilters(Components.interfaces.nsIFilePicker.filterText | Components.interfaces.nsIFilePicker.filterAll);
    12541159
    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
    12691206      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
    13151212      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.");
    13281249  },
    13291250 
  • modules/vI_smartIdentity.js

    rbc6c6b r85fa10  
    5858    var msgHdr;
    5959    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)
    6161
    6262    var newsgroup = this._msgCompose.compFields.newsgroups;
     
    156156      ((this._smartIdentityCollection._allIdentities.number == 1 && vIprefs.get("idSelection_ask_always")) || this._smartIdentityCollection._allIdentities.number > 1)) {
    157157      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 + ")");
    159159      }
    160160      this._currentWindow.openDialog("chrome://v_identity/content/vI_smartReplyDialog.xul", 0,
     
    172172    let allIdentities = self._smartIdentityCollection._allIdentities;
    173173    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 + ")");
    175175   
    176176//     allIdentities.menuItems[selectedValue].setAttribute("accountkey",
  • modules/vI_smartIdentityCollection.js

    rbc6c6b r85fa10  
    9595
    9696    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)
    9898
    9999    this._allIdentities.addWithoutDuplicates(newIdentity);
     
    160160    for (var index = 0; index < number; index++) {
    161161      var newIdentity = new identityData(this._currentWindow, emails.value[index], fullNames.value[index],
    162         null, NO_SMTP_TAG, null, null);
     162        null, null, null);
    163163      identityCollection.addWithoutDuplicates(newIdentity);
    164164    }
Note: See TracChangeset for help on using the changeset viewer.