Archive for February, 2008

The Road to Code v0.1

Prepare for a very long blog post. This might even fill up the whole Planet 🙂

Change of Plans

Originally my slideshow was to open a new window and make the slideshow in there. But apparentlly there is already an extension to do it, uniquely called “Slideshow“. This extension though in my opinion is really an attachment picture viewer. Because it doesn’t automate a slideshow.

Either way, this means I have to make a few changes my extension. So I went back to what I wanted originally. To replace the picture attachments under the email in the messagepane (inline attachments) and to be a true slideshow.


So the research begins. I went and looked at the XUL of Thunderbird to understand it.

  • Looking in the above, the “messagepanebox” is where the email is (in the classic view, it is the bottom right section).
  • “msgNotificationBar” is most likely the bar that pops up like “This is Spam” or “Images are disabled”
  • “msgHeaderView” displays the header information of the email like who sent it, subject, and if expanded the more detailed information
  • “messagepane” is where the actually email is displayed. As you can see it is a “browser” like in Firefox. So it most likely just pointing to a file in your profile (containing the email messages), decoded and then displayed here.
  • “attachment-splitter” is the division from the…
  • “attachmentView” where the attachments are displayed

Anyway, the attachments can be displayed inline in the email or not (which is what I plan to replace) by the user preference “Display Attachments Inline” which can be toggled under the “View” menu.

So I searched for that text ->

Which brought me here ->

And ended here ->

Basically what it says is, change the user pref then just do a reload of the email. Kinda like the lab we had with the “View Image” is really just change the location bar to the path and load it.

I thought, since it is a “browser”, it would just apply a “display: none” or “visibility: hidden” CSS property but I guess not.

So I went to research the actually rendering of the email. If you ever “View Source” of the email with attachments, you will notice that is divided up into sections like the text message and then a bunch of characters under for the attachments. This is because email was originally designed just for text (ASCII) so for images (binary) they have to be encoded.

I went into circles and I ended up actually reading the C++ code that actually does the decoding process. I don’t plan on touching that.

So, I came back where I started and remembered that the messagepane is a “browser” therefore the email is rendered like an HTML page. Using DOM inspector, I looked into it.


As you can see, there are just a bunch of HTML tags. The message is put into a DIV and is displayed according to what is set (HTML or plain text). For the attachments, it is a HR for the horizontal rule, BR, CENTER to center the image and the image, for each attachment (outlined in red). As you can see in the image, there is the SRC for the image which is pointing to the imap path. I assume if it was POP it will will point to the file on the hard drive.

I also noticed if I uncheck “Display Attachments Inline”, it doesn’t render the image attachments (not a hide/visible that I originally thought). Makes sense, as if the images are huge, you don’t want to wait to download, decode and then just hide them.

The Road to Code v0.1

So I read up on how to make an extension. I found a “Hello Thunderbird” extension. It is unfortunately out of date (using old methods like contents.rdf). It will still work fine but I went up and look at how current extensions are made.

There are two goals for my v0.1

  1. To get all the attachments (ideally just the images)
  2. To manipulate the email, to render what I want (which will eventually be the slideshow)

So I went to work, read up some stuff (as I don’t know Javascript) and so forth. Here are the results…


As you can see, the alert in the middle shows the image name, content-type,  URL and URI. If you click ok, and if another image is there, it will display that info. If there are no images, it displays an alert (for debugging purposes) saying no images found as expected 🙂

As well you can see little red “Hi” boxes next to the image. That was added by me so I know where to add code and as well what I can add 🙂 To display the colours, I used the following in my userContent.css

center span {   background-color: #f00;border: 1px solid #000;}

So all is looking good 🙂

Goals for v0.2

Well not that I got the basics done, what to look forward to next?

  • Get the a slideshow box
  • Change images. This should be easy (theoretically), as I will just have to change the IMG SRC to the next image’s SRC and vice versa for the back button
  • Have a real slideshow. A timer to automate the change.
  • User prefs? Like what images to show, etc…

Download v0.1: attachment_slideshow.xpi

NOTE: I only tested it in TB v2.0.0.12. I know I was suppose to use v3.0pre but I am having problems with my build for some reason. Once I have time, I will test it on v3.0pre.

User “stalking” ;)

One of our TODOs in OSD600 was to watch a user in Bugzilla and see what kind of bugs s/he is watching, replying and contributing to. I choose Joey Minta as he is one of people Dave referred a few weeks back. From what I see, he is mainly focused on Lightning/Sunbird, the Calendar application. Lightning is meant to intergrate to Thunderbird and Sunbird meant to be a standalone application (nice of Mozilla to separate it ^_^ so you are not forced to use TB if you want a calendar app). I don’t use a calendar application so wouldn’t know much about it (I keep appointments in my head ^_^). One bug I see is he is replacing something RDF to JS driven (414038) (which I have no idea what RDF is or what it is used for). Another interesting one is “Clean up Thunderbird’s global scope a bit” (416666). Nice to see some spring cleaning 😀 Another one bug was from 2000 :O Anyway, it was interesting to see what discussion take place in bugs. Some about fixing (and break ;)) stuff, changing core components and even little things like how the UI should look like 🙂

Getting back into gear

Been busy for the past week so I am way behind in my blog. I will posting a bunch in the next few days. The reason being both work and school with mid term tests. I also wanted to finish working on my personal website which is done in PHP and MySQL (But time to put that in the backburner, as the assignments are due in less than a week).

Task List

– Report on the Bugzilla user watching

– Change of v0.1 specs, report on what I have so far

– Report on our in-class lab

Watch for the above to be posted soon…

Thunderbird Picture Preview Release Plan

The current release plan of my project is as follows…


– Have an extension package (XPI)

– Make a new window and display all the attachments (like their names). Would be good if it is already just the images.


– Display the images

– Have basic forward and back movement


– Fade In/Out

– Graphical look

– Full Screen mode?

– Cross platform debugging and testing

Don’t know if that is sufficient. Feel free to post comments on it.

And a searching we will go…

With the project selected, it is now time to find and search on how to get started. I’m going to make it an extension so I read up some tutorials on how to do it and now have a basis XPI file. All it does it add to the extensions list and does nothing (yet).

The project is to display the image attachments into a slide show like the many slide shows you now see in websites 🙂 With the cool fade in/out, the grey background and all the web 2.0 jazz without Adobe flash (yeah!).

Since this is my first time to actually look into the working of Thunderbird, I looked into the XUL and JS to see how it works. And so far, I think I’m starting to know where things are laid out.

First question comes to mind is the GUI. Where to actually put out the slide show? Below is a picture of the “messagepanebox”. (If you wondering what’s with the black boxes is because I’m a “privacy freak”).


1) First idea was in the “messagepane” because it is already previewing the images (it knows which attachments are images. Most likely by mime-type). It seems to make a horizontal rule and then the centred image below it (and repeat for the next attachment). I planned to like override the function to display all the images in one area so you don’t have to keep scrolling down. Sadly, after tons of searching I can’t seem to figure out where it is actually doing the display. I know that “Display Attachments Inline” will show/hide it. But no where can I find what renders it. jminta suggested it maybe in the libmime 🙁

2) Since I can’t find on how to do the above, the easiest way is just make a new window and do the slide show there. Since it is just a separate browser window it makes it much easier. It will be easy to port it to do (1) once I figure out how to do it as the code would be re-useable. The good thing with this too is maybe I can add a full screen feature like in Firefox.

3) Like (2) except just replace the whole “messagepane” instead of a new window. So instead of looking into the email, just display the slideshow.

Either way I do it, once the basis of the code is done, it should be easy to port to do all 3.