What, writing your own extension? Ok, all you need is the will to learn and some basic knowledge of programming in javascript and xml syntax. It took some time till I had my first extension finished, so here are some Information how to start... A good way to start is to read the following tutorials to get an overview:

Both are not directly for Thunderbird, but the main information is the same. So i reinstalled my thunderbird with debugging messages and activated the inspector extension... On my gentoo machine I had to use the "debug" USE-flag to enable debug messages, but I didnt find any easy way to activate the inspector extension, so I had to patch the mozilla.eclass file in /usr/portage/eclass to build it. patchexternal link new mozilla.eclassexternal link

Then i looked for the chrome directory of my new installation, it was in /usr/lib/MozillaThunderbird. To be shure nothing gets destroyed I copyd this directory to chrome_new (cp -r chrome chrome_new), moved it to chrome_orig (mv chrome chrome_orig) and than set a symbolic link to the chrome_new directory (ln -s chrome_new chrome). This enabled a save switch-back to the standard installation if something really goes wrong or between hacking sessions by simply changing the link. On the other hand it was useful for transforming the extension into a dynamic overlay at the end.

Now I changed to the chrome_new directory and extracted all files in that directory with a .jar extension. for file in *.jar; do unzip $file; done Than told the chrome registry to use the extracted versions of the files: perl -pi.orig -e 's/(jar:)|(\/[^.\/]+\.jar!)//g' chrome.rdf installed-chrome.txt and I had a editable thunderbird.

So it was time to look for the element to change using the inspector. Start inspector, choose file->Inspect a Window->*Thunderbird and browse through the elements and look for the red frames blinking. If you have the element to change, you can search for it in your chrome directory and change it with your preferred editor. You have now free choice to change anything you like and its a good way to change things in this place before creating a dynamic overlay from it. I dont know if its a good idea to remove elements, maybe they are needed by other functions, so its likely better to add some stuff...

If you had done so far and you really like your extension, make it dynamic by converting it in an overlay. The link above and the following link will help you in doing this job:

While converting my extension to a dynamic overlay I had two serious problems:

  • HOWTO overlay an element without an id?
    Look if this element has a child with an id, search for this child in javascript and than give the parent element of this child an id.
    var Obj_MsgIdentity = document.getElementById("msgIdentity");
    var parent_hbox = Obj_MsgIdentity.parentNode;
    parent_hbox.setAttribute("id", "msgIdentityHbox");
  • HOWTO add code to an existing function?
    Replace the function with your own one and call it inside your own one (code adapted from enigmail)
    if (typeof(GenericSendMessage)=="function") {
    // replace GenericSendMessage with our own version
    var origGenericSendMessage = GenericSendMessage;
    GenericSendMessage = function (msgType) {
    function fakeGenericSendMessage( msgType )
    dump("fakeGenericSendMessage from XUL\n");
    // here you can dio whatever you like
    origGenericSendMessage( msgType )

So it is possible to nearly convert every working code from your chrome dircetory in a dynamic extension, the above firefox-extension-link was very helpful for me. The rest is looking into other extensions and adapting code if necessary... ok, some information at the end which I used for my extension...

If you read through all the text and then completed your first extension for thunderbid, you will need the folowing id-number of thunderbird: {3550f703-e582-4d05-9a08-453d09bdfdc6} ...happy hacking...

Created by: rene last modification: Monday 14 of March, 2005 [18:15:38 UTC] by admin

The original document is available at http://www.absorb.it/tiki-index.php?page=ExtensionHowto