Wednesday, February 11, 2009

Thunderbird Extension Development

I've spent the last two weeks developing a thunderbird(tb) extension and I must say trying to find information specific to tb development is very hard to come by. Firefox plugin development information is all over the place. But tb resources are hard to come by. I have put together a quick reference that will hopefull get crawled by google and maybe give some help to others that are trying to do the same thing. Please not that this is just a qucik reference, of things I foudn to get the job done...they might not be the best method of doing things but it gets the job done.

Thunderbird Extension Development


Overlay Reference:

  • chrome://messenger/content/messenger.xul- statusbar

  • chrome://messenger/content/mailWindowOverlay.xul- Toolbar Menu (taskPopup), Message Context Menu (threadPaneContext)

  • chrome://messenger/content/msgHdrViewOverlay.xul- Attachment Context Menu (attachmentListContext)

Accessing Attachments

  1. var attachmentList = document.getElementById( 'attachmentList' ) // returns attachment list

  2. var selectedAttachments = attachmentList.selectedItems; //Get selected attachments


Getting Message Information

var MessageUri = GetFirstSelectedMessage(); // Get Message URI


/* Get message body as it appears in preview window */

body = document.getElementById("messagepane").contentDocument.body.innerHTML;


Accessing Limited Message Header information

  1. var msg = messenger.messageServiceFromURI(uri); // get message object

  2. var hdr = msg.messageURIToMsgHdr(uri); // get header object

  3. var subject = hdr.mime2DecodedSubject; // get Subject

  4. var from = hdr.mime2DecodedAuthor; // get From

  5. var to = hdr.mime2DecodedRecipients; // get To

  6. var msgdate = new Date( hdr.date/1000); // turn epoch into date

  7. var messageid = hdr.messageId; // get message ID



Downloading Attachments

This piece of code will take all selected attachments and download them to C:\ with their original filenames.


  1. attachments = this.getSelectedAttachments();

  2. for( i=0;i

  3. var attachment = attachments[i];


  4. /* Create a file interface object */

  5. var file = Components.classes["@mozilla.org/file/local;1"].

  6. createInstance(Components.interfaces.nsILocalFile);

  7. var fullfilepath = 'C:/test/' + attachment.displayName;

  8. file.initWithPath(fullfilepath);

  9. if(!file.exists()) {

  10. file.create(0x00,0644);

  11. }

  12. messenger.saveAttachmentToFile( file, attachment.url, attachment.uri, attachment.contentType, null );

  13. }

Sunday, February 1, 2009

Upgrading My Desktop

So I am going to upgrade my computer....here is what i am going with:

Intel BOXDP35DPM LGA 775 Intel P35 ATX Intel Motherboard

ASUS EN9800GT HB/HTDI/512M GeForce 9800 GT 512MB 256-bit GDDR3 PCI Express 2.0 x16 HDCP Ready SLI Supported

hec X-Power Pro 600 600W Continuous @ 40°C ATX12V V2.2 SLI Ready CrossFire Ready Power Supply

Intel Core 2 Quad Q8200 2.33GHz LGA 775 95W Quad-Core Processor Model BX80580Q8200

I am also going with 8GB of ram.

Only thing let to decide on it CPU cooling.

Linux will rock and I will be dual booting XP(maybe Vista) so that I can play StarCraft 2 when it comes out.


Comments/ Suggestions??