Tag Archives: thunderbir

Mozilla Thunderbird – Implementing the ISP Hook in 5.0 and later

Out buddies at MozillaMessaging are at it again… new with Thunderbird 5.0, all of the “jar” files previously present in the Thunderbird installation directory have been collapsed into a single “omni.jar” file, apparently for program load optimization.

This all would be fine with me if the omni.jar were a “normal” zip file, and the previous jars were. Instead, this is an “optimized” jar, that is not recognized by 7-zip as a valid zip archive. It is not clear to me how the jar is “optimized”, or how to re-apply optimizations when modifying the original, nor do I particularly care as load optimization is of little concern to us… we are not operating with 10 year old equipment, for the most part, so who cares?

I have had to work around the problem by using “jar.exe” from the Java JDK. This program extracts and re-creates omni.jar in a way that Thunderbird does not mind. The resultant file size is about the same, too.

Another quirk of the new version is that the default “prefs.js” file, while present in omni.jar, is not copied into the resultant Program Files directory at install time. On a clean install, there is no default prefs.js! I had to populate a new prefs.js into the “core” installer directory, outside of the new “omni.jar”.

Finally, there are no more “localized/nonlocalized” directories in the installer, just that which is within “omni”, and that which is not. So, I put our prefs.js in .\core\defaults\profile (a new directory in the installer zip). Previously it was in .\nonlocalized\defaults\profile. Likewise, our mailnews.js and ISP Hook “.rdf” files also go in “core” instead of “localized”.

Other than that, the RDF ISP Hook file that we are using is unchanged from the one documented here:
Prefs.js is the same as in the SharePoint site, with the modifications noted here:

What a bunch of gibberish talk… sorry for the dry post. I am guessing if you are a Thunderbird customizer, you will know what I am talking about. If not, you won’t be reading anyway.

On to the build script, in Windows BAT/CMD language:

REM Thunderbird customized build script for UVM.
REM Updated September 2011 for Thunderbird 5.0 support.
REM – 7z.exe, 7zr.exe and sed.exe in parallel "..\bin" directory
REM – Unmodified Thunderbird installer in .\source directory
REM – all required config files in .\config directory
REM (including 7z control file, ISP Hook RDF file, and modified prefs.js)
REM – local JDK install with "jar.exe". Path to jar.exe will need to be updated in the jdk environment variable
REM OUTPUT: Fully modified Thunderbird installer in .\Installer directory.
REM @echo on

set jdk="c:\Program Files (x86)\Java\jdk1.6.0_27\bin"

Echo Cleaning up old builds…
del .\Installer\*.exe
rmdir /s /q .\build
set /P tbver=Enter Thunderbird version number to build (i.e. "6.0.2"):

Echo Extracting setup files from OEM Installer…
mkdir .\build\temp
..\bin\7zr x .\source\*.exe -o.\build

Echo Extracting omni.jar contents…
mkdir .\build\temp
cd .\build\temp
%jdk%\jar.exe xf ..\core\omni.jar

Echo modifying messenger functions…
..\..\..\bin\sed.exe –binary "s/NewMailAccount(msgWindow, okCallback);/MsgAccountWizard(okCallback);/" .\chrome\messenger\content\messenger\msgMail3PaneWindow_new.js
MOVE /Y .\chrome\messenger\content\messenger\msgMail3PaneWindow_new.js .\chrome\messenger\content\messenger\msgMail3PaneWindow.js

Echo modifying default mailnews preferences…
..\..\..\bin\sed.exe –binary "s/try_ssl\", 0)/try_ssl\", 2)/" .\defaults\pref\mailnews_new.js
MOVE /Y .\defaults\pref\mailnews_new.js .\defaults\pref\mailnews.js

Echo moving UVM modified prefs.js into place (note that this file is not actually used by Thunderbird!)
copy /Y ..\..\config\prefs.js .\defaults\profile\prefs.js

Echo Repacking omni.jar…
del /f /q ..\core\omni.jar
%jdk%\jar.exe cf ..\core\omni.jar *

Echo Copying UVM Custom ISP file to source…
cd ..\..\
mkdir .\build\core\isp\en-US
copy /Y .\config\UVMMail.rdf .\build\core\isp\en-US\UVMMail.rdf
Echo Copying UVM default prefs.js to core directory (tbird no longer has a prefs.js by default, but it will be used if present)…
mkdir .\build\core\defaults\profile
copy /Y .\config\prefs.js .\build\core\defaults\profile\prefs.js

Echo Deleting temporary files that should not be present in the installer…
rmdir /s /q .\build\temp

Echo Repackaging Thunderbird installer…
..\bin\7zr a .\Installer\UVM_Thunderbird_setup_%tbver%.7z .\build\*
copy /b ..\bin\7zS.sfx + .\config\config.txt + .\Installer\UVM_Thunderbird_setup_%tbver%.7z .\Installer\UVM_Thunderbird_setup_%tbver%.exe

Echo Cleaning up installation source…
del /s /f /q .\build\*.*
rmdir /s /q .\build\core
rmdir /s /q .\build
del /f /q .\Installer\UVM_Thunderbird_setup_%tbver%.7z