Changeset b9a8f87


Ignore:
Timestamp:
Jul 21, 2008, 12:25:36 PM (12 years ago)
Author:
rene <rene@…>
Branches:
master
Children:
b13a12
Parents:
ff647c
Message:

simplified version comparison

Location:
chrome/content/v_identity
Files:
5 edited

Legend:

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

    rff647c rb9a8f87  
    6565
    6666var vI_helper = {
     67    // simplified versionChecker, type is "TB" or "SM"
     68    // returns true if appVersion is smaller or equal version
     69    olderVersion : function (type, version) {
     70        var appID = null; var appVersion = null;
     71        const THUNDERBIRD_ID = "{3550f703-e582-4d05-9a08-453d09bdfdc6}";
     72        const SEAMONKEY_ID = "{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}";
     73
     74        var versionChecker;
     75        if("@mozilla.org/xre/app-info;1" in Components.classes) {
     76            var appInfo = Components.classes["@mozilla.org/xre/app-info;1"]
     77                .getService(Components.interfaces.nsIXULAppInfo);
     78            appID = appInfo.ID
     79            appVersion = appInfo.version
     80        }
     81        if ((type == "TB" && appID != THUNDERBIRD_ID) ||
     82            (type == "SM" && appID != SEAMONKEY_ID)) return null;
     83
     84        if (!version) return ((type == "TB" && appID == THUNDERBIRD_ID) ||
     85            (type == "SM" && appID == SEAMONKEY_ID))
     86
     87        if("@mozilla.org/xpcom/version-comparator;1" in Components.classes)
     88            versionChecker = Components.classes["@mozilla.org/xpcom/version-comparator;1"]
     89                .getService(Components.interfaces.nsIVersionComparator);
     90        else return null;
     91       
     92        return (versionChecker.compare(appVersion, version) < 0)
     93    },
     94
    6795    // "accountname" property changed in Thunderbird 3.x, Seamonkey 1.5x to "description"
    6896    getAccountname: function(elem) {
  • chrome/content/v_identity/vI_prefDialog.js

    rff647c rb9a8f87  
    273273        onInitCopiesAndFolders()
    274274
    275         var appID = null;
    276         var appVersion = null;
    277         var versionChecker;
    278         if("@mozilla.org/xre/app-info;1" in Components.classes) {
    279             var appInfo = Components.classes["@mozilla.org/xre/app-info;1"]
    280                 .getService(Components.interfaces.nsIXULAppInfo);
    281             appID = appInfo.ID
    282             appVersion = appInfo.version
    283         }
    284         if("@mozilla.org/xpcom/version-comparator;1" in Components.classes)
    285             versionChecker = Components.classes["@mozilla.org/xpcom/version-comparator;1"]
    286                 .getService(Components.interfaces.nsIVersionComparator);
    287         else appID = null;
    288         const THUNDERBIRD_ID = "{3550f703-e582-4d05-9a08-453d09bdfdc6}";
    289         const SEAMONKEY_ID = "{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}";
    290         if ((!appID) || (appID == THUNDERBIRD_ID && versionChecker.compare(appVersion, "2.0b") < 0) ||
    291             (appID == SEAMONKEY_ID && versionChecker.compare(appVersion, "1.5a") < 0)) {
     275        if (vI_helper.olderVersion("TB", "2.0b") || vI_helper.olderVersion("SM", "1.5a")) {
    292276            document.getElementById("version-warning").setAttribute("hidden", "false");
    293277            document.getElementById("VIdent_identity.smart_draft").setAttribute("disabled", "true");
    294278        }
    295         if ((!appID) || (appID == THUNDERBIRD_ID && versionChecker.compare(appVersion, "1.5.0.7") < 0)) {
     279        if (vI_helper.olderVersion("TB", "1.5.0.7")) {
    296280            document.getElementById("notificationGroupBox").setAttribute("hidden", "true");
    297281        }
    298         if ((!appID) || (appID == THUNDERBIRD_ID && versionChecker.compare(appVersion, "2.0") < 0)) {
     282        if (vI_helper.olderVersion("TB", "2.0")) {
    299283            document.getElementById("fccReplyFollowsParentBox").setAttribute("hidden", "true");
    300284        }
    301         if ((!appID) || (appID != THUNDERBIRD_ID)) {
     285        if (vI_helper.olderVersion("SM", null)) { // any known seamonkey version
    302286            document.getElementById("VIdent_identity.menu_entry").setAttribute("hidden", "true");
    303287        }
  • chrome/content/v_identity/vI_prefDialog.xul

    rff647c rb9a8f87  
    5555<script type="application/x-javascript"
    5656            src="chrome://v_identity/content/vI_storageExtras.js" />
     57<script type="application/x-javascript"
     58            src="chrome://v_identity/content/vI_helper.js" />
    5759
    5860  <stringbundleset id="stringbundleset">
  • chrome/content/v_identity/vI_storageExtras.js

    rff647c rb9a8f87  
    6262
    6363    seamonkey_to_old : function() {
    64         if (vI_storageExtrasHelper.seamonkey_old == "true") return true;
    65         var versionChecker;
    66         if("@mozilla.org/xre/app-info;1" in Components.classes) {
    67             var appInfo = Components.classes["@mozilla.org/xre/app-info;1"]
    68                 .getService(Components.interfaces.nsIXULAppInfo);
    69             appID = appInfo.ID
    70             appVersion = appInfo.version
    71         }
    72         if("@mozilla.org/xpcom/version-comparator;1" in Components.classes)
    73             versionChecker = Components.classes["@mozilla.org/xpcom/version-comparator;1"]
    74                 .getService(Components.interfaces.nsIVersionComparator);
    75         else appID = null;
    76         const SEAMONKEY_ID = "{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}";
    77         if (appID == SEAMONKEY_ID && versionChecker.compare(appVersion, "1.5a") < 0)
    78             vI_storageExtrasHelper.seamonkey_old = "true"
    79         return (vI_storageExtrasHelper.seamonkey_old == "true")
     64        if (vI_storageExtrasHelper.seamonkey_old != "true")
     65            vI_storageExtrasHelper.seamonkey_old = vI_helper.olderVersion("SM", "1.5a")
     66        return (vI_storageExtrasHelper.seamonkey_old)   
    8067    }
    8168}
  • chrome/content/v_identity/v_identity.js

    rff647c rb9a8f87  
    131131            vI_notificationBar.dump("## v_identity: VIdentity_GenericSendMessage\n");
    132132            vI.msgType = msgType;
     133           
    133134            // dont allow user to fake identity if Message is not sended NOW and thunderbird-version is below 2.0 !!!!
    134             var appID = null;
    135             var appVersion = null;
    136             var versionChecker;
    137             if("@mozilla.org/xre/app-info;1" in Components.classes) {
    138                 var appInfo = Components.classes["@mozilla.org/xre/app-info;1"]
    139                     .getService(Components.interfaces.nsIXULAppInfo);
    140                 appID = appInfo.ID
    141                 appVersion = appInfo.version
    142             }
    143             if("@mozilla.org/xpcom/version-comparator;1" in Components.classes)
    144                 versionChecker = Components.classes["@mozilla.org/xpcom/version-comparator;1"]
    145                     .getService(Components.interfaces.nsIVersionComparator);
    146             else appID = null;
    147             const THUNDERBIRD_ID = "{3550f703-e582-4d05-9a08-453d09bdfdc6}";
    148             const SEAMONKEY_ID = "{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}";
    149135            if (msgType != nsIMsgCompDeliverMode.Now &&
    150                 ((!appID) || (appID == THUNDERBIRD_ID && versionChecker.compare(appVersion, "2.0b") < 0) ||
    151                 (appID == SEAMONKEY_ID && versionChecker.compare(appVersion, "1.5a") < 0))) {
     136                ((vI_helper.olderVersion("TB", "2.0b") || vI_helper.olderVersion("SM", "1.5a"))) {
    152137                var server = gAccountManager.defaultAccount.incomingServer.prettyName
    153138                var name = gAccountManager.defaultAccount.defaultIdentity.fullName
Note: See TracChangeset for help on using the changeset viewer.