#!/usr/bin/perl # # pinehelper.pl - Original from Ben Okopnik of LinuxGazette.net # # i) install in /usr/local/bin/pinehelper, make it world execute. # # ii) edit the user's prefs.js (via "about:config") in # ~/.mozilla/firefox/$blah.default: # # user_pref("network.protocol-handler.app.mailto", \ # "/usr/local/bin/pinehelper"); # # iii) edit "$fn" and "geometry" to taste. # # restart FF and clicking on a mailto: link should fire up # an xterm running mutt. To: will already be filled in. if # the link provided a Subject:, it should be as well. # # 13Nov2005 Ben Okopnik 0001 Fix Firefox mailto: handling # 16Jun2007 sbk 0002 bulletproofing, strict, my(). # use diagnostics; use warnings; use strict; my ( $fn, @chunks, $k, $v, %header, $opts); $fn = q(-*-*-medium-r-normal-*-12-*-*-*-c-*-iso8859-15); @chunks = split /[?&]/, shift; for ( @chunks ) { ( $k, $v ) = split /[:=]/; # Cheap-ass entity conversion # ( $header{ $k } = $v ) =~ s/%(..)/pack("H2",$1)/eg; } # Define Mutt switches for any headers we're interested in, including # optional ones # $opts = qq[ -s "$header{subject}" ] if exists $header{subject}; $opts .= $header{mailto}; exec qq(/usr/bin/xterm -fn $fn -geometry 105x45-71+49 -T Mutt -e /usr/bin/mutt $opts) || die qq(Blue? No, red?! Aiiii!: $!); __END__