Reinventing Fire

Archived Link Thunderbird Extension

August 24, 2011

Filed under: Code,Email,Technical,W3C,Work — Magister @ 12:21 am

This week is our first Geek Week at W3C. The idea is to have a week where we improve our skills, collaborate with each other on prototypes and fun projects that help W3C, and to come up for air from our everyday duties. I’m working on a few projects, some small and some larger.

One of my projects is to make a plugin for Thunderbird, my email client of choice, which exposes the Archived-At email message header field, normally hidden, as a hyperlink. This is useful for W3C work because we often discuss specific email messages during teleconferences (“telcons”), and we want to share links to (or otherwise find or browse to) the message in W3C’s email archives. It’s also handy when you are composing messages and want to drop in links referring to other emails. (I do way too much of both of these.)

I’ve made extensions for Firefox before, but never for Thunderbird, so this was an interesting project for me.

One of the cool (and I think unusual) things that W3C does is to attach an email header field to each message, providing a link back to the place in our archives where the message is stored. This is defined in RFC 5064. These links are very useful, but most email clients don’t do anything with them… you can only see them when you view all the headers, and then you have to hunt for them among the gobbledygook.

I’m in the process of migrating to my new Macbook Air 13″ (hooray!). This is my second Mac (I was a Windows guy before), and I thought I’d take the opportunity to rebuild my setup from scratch, rather than importing my old settings, so I could do some optimizing.

This means that I’m installing and configuring a lot of software (including some updated versions that wouldn’t run on my old Snow Leopard OS), like Thunderbird. Over the years, I’d installed several plugins for Thunderbird, some of which no longer worked. One of those exposed the message headers, but it was a pain to use. I was also able to expose the header by changing the “mailnews.customHeaders” preference in Thunderbird, but that still didn’t give me what I wanted… I had to copy the header manually, < and > bookends and all, and paste it in the browser bar, edit out the delimiters… clumsy. I raised a bug on it a couple years ago, but never got the gumption to do anything about it.

Until now, that is. Now I’ve made an extension to do the grunt work for me (laziness being the true mother of invention). My new extension, Archived Link, exposes the Archived-At email header as a hyperlink, and when you click it, it opens in in your default browser; it also copies it into your clipboard (an option you can change in the preferences).

I cobbled the plugin together from scraps I found around the Web. I borrowed heavily from the framework of the first plugin I found that added a line to the email header message pane, Andrew Van Tassel‘s cool MailHops Thunderbird Plugin.

I also got timely and friendly help from Jonathan Protzenko (protz) and Jim Porter (squib) on Mozilla’s #maildev IRC channel, for which I’m very grateful.

If this seems like something useful to you, please download the Archived Link extension and install it in Thunderbird. Let me know what you think.


Update 1: Screencap

Just to make it more clear what this extension does, I decided to add a screencap:
Screen capture of Archived-At header displayed in Thunderbird message header pane


Update 2: Mozilla Add-Ons App Store

I’ve now submitted Archived Link to Mozilla’s Addons site. It still needs review, but you can find it via the direct link to Archived Link.

13 Comments

  1. Cool extension, bro.
    Can you make it so that you can copy the link without it opening in the browser? Most of the time I just want access to the URL so that I can paste it into another mail, rather than opening it up.  When I right click on the link, it briefly pops up a menu with a single item Customize (which I guess is Thunderbird’s standard menu there?) before switching over to Firefox to open the page.  I think I expected there to be a Copy Link menu item there.

    Comment by Cameron McCormack — August 24, 2011 @ 1:07 am

  2. Hey, Cam. Thanks for checking it out! I’ve now added an option to not follow the link, so you can just copy it. It would be more work to add an item to a menu, but I can work on that later… sounds like a good idea.

    Comment by Schepers — August 24, 2011 @ 1:35 am

  3. Hey Doug, thanks for the extensions. It will make our telcons more productive, for sure!

    Comment by Cyril — August 24, 2011 @ 3:51 am

  4. Great stuff! Any plan to get this extension on addons.mozilla.org so it can get easily updated?

    Comment by kazé — August 24, 2011 @ 6:29 am

  5. …huh.  I never knew that the W3 added that header.  That… makes things easier.

    Comment by Tab Atkins Jr. — August 24, 2011 @ 12:17 pm

  6. Hey, kazé, yeah, I do plan on it. My experience with submitting Firefox extensions a few years ago wasn’t very positive (there were a lot of hassles, both from the system itself and from certain unfriendly people there), but I’m sure things have improved. To be honest, I doubt that many people outside W3C will find this particularly useful, since most email services don’t seem to use the Archived-At header, but I may as well let people find and install it more easily… and update it, as you say.

    Comment by Schepers — August 24, 2011 @ 12:21 pm

  7. nice work! I recently made a couple trivial shell scripts to accomplish similar things in Mutt: Ctrl-X copies a pointer to the current message to my clipboard, and Ctrl-O opens the current message in my web browser.
    http://impressive.net/people/gerald/2011/04/w3c-browse-message
    http://impressive.net/people/gerald/2011/04/w3c-copy-archive-uri
    (My implementations use Message-Id instead of Archived-At because I wanted them to work while viewing messages in my outbox as well as with mail from lists)

    Comment by Gerald Oskoboiny — August 24, 2011 @ 6:28 pm

  8. Magic, thanks!

    I’ve long been a great fan of the Archived-at header – this makes it even more useful.

    #g
     

    Comment by Graham Klyne — August 25, 2011 @ 4:07 am

  9. I’ve been hacking at an AppleScript to do this in Mail.app for a few years now, never quite getting it working.  This inspired me to give it another shot.  My lack of patience shows in this source code, so take it for what it’s worth.  You can use Automator to make a service out of it.  It also doesn’t work on “X-Archived-At”, which some of the older mail messages in my inbox use.

    tell application “Mail”
    set theSelection to selection
    (* I gave up trying to understand enough AppleScript to extract the headers properly, but I did figure out how to get the raw source and search strings *)
    set theSource to source of item 1 of theSelection
    set theOffset to offset of “Archived-At: <” in theSource
    if theOffset is equal to 0 then
    return
    end if
    set theOffset to theOffset + 14
    set theChar to itemtheOffset of theSource
    set theUrl to “”
    repeat while theChar is not equal to “>”
    set theUrl to theUrl & theChar
    set theOffset to theOffset + 1
    set theChar to itemtheOffset of theSource
    end repeat
     
    tell application “Safari”
    open locationtheUrl
    end tell
     
     
    end tell 

    Comment by Matt Womer — August 26, 2011 @ 8:33 pm

  10. In Mail.app, I’ve used the built-in feature to show custom headers:

    Preferences > Viewing > Show header detail > Custom… > ‘+’ > add ‘Archived-At’

    My main use case has been to copy and paste the Archived-At link into a mail, and this has worked well.

    Comment by Anssi Kostiainen — August 29, 2011 @ 3:36 am

  11. Yes, this is nice Doug. Thanks!
    (I agree with Cam that making it easy to copy the URI or to launch a new tab via the UI [rather than changing configuration settings] would be nicer.)

    Comment by AF Barstow — August 29, 2011 @ 4:15 pm

  12. Hey, Art, I agree too, and will get around to that sometime.

    Comment by Schepers — August 29, 2011 @ 5:13 pm

  13. @anssi, yeah, I use the headers feature in Mail.app too, but find myself always having to tidy it up, as I catch a < or >, or miss a character or two.  Ultimately, I’d like to write AppleScript that just presents the header as a link, with all the usual options that come with that, but this was a quick hack.

    -M
     

    Comment by Matt Womer — August 30, 2011 @ 3:20 pm

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress