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 .coredefaultsprofile (a new directory in the installer zip). Previously it was in .nonlocalizeddefaultsprofile. 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)Javajdk1.6.0_27bin"

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 .buildtemp
..bin7zr x .source*.exe

Echo Extracting omni.jar contents…
mkdir .buildtemp
cd .buildtemp
%jdk%jar.exe xf ..coreomni.jar

Echo modifying messenger functions…
……binsed.exe –binary "s/NewMailAccount(msgWindow, okCallback);/MsgAccountWizard(okCallback);/" .chromemessengercontentmessengermsgMail3PaneWindow_new.js
MOVE /Y .chromemessengercontentmessengermsgMail3PaneWindow_new.js .chromemessengercontentmessengermsgMail3PaneWindow.js

Echo modifying default mailnews preferences…
……binsed.exe –binary "s/try_ssl", 0)/try_ssl", 2)/" .defaultsprefmailnews_new.js
MOVE /Y .defaultsprefmailnews_new.js .defaultsprefmailnews.js

Echo moving UVM modified prefs.js into place (note that this file is not actually used by Thunderbird!)
copy /Y ….configprefs.js .defaultsprofileprefs.js

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

Echo Copying UVM Custom ISP file to source…
cd ….
mkdir .buildcoreispen-US
copy /Y .configUVMMail.rdf .buildcoreispen-USUVMMail.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 .buildcoredefaultsprofile
copy /Y .configprefs.js .buildcoredefaultsprofileprefs.js

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

Echo Repackaging Thunderbird installer…
..bin7zr a .InstallerUVM_Thunderbird_setup_%tbver%.7z .build*
copy /b ..bin7zS.sfx + .configconfig.txt + .InstallerUVM_Thunderbird_setup_%tbver%.7z .InstallerUVM_Thunderbird_setup_%tbver%.exe

Echo Cleaning up installation source…
del /s /f /q .build*.*
rmdir /s /q .buildcore
rmdir /s /q .build
del /f /q .InstallerUVM_Thunderbird_setup_%tbver%.7z