[TAG] Re: mailto:tag at lists.linuxgazette.net?subject=%20Re%3A%20%5BLG%20120%5D%20help%20wanted%20%233
s. keeling
keeling at spots.ab.ca
Mon Nov 14 07:10:35 MSK 2005
Incoming from Benjamin A. Okopnik:
> On Sun, Nov 13, 2005 at 11:04:17AM -0700, s. keeling wrote:
> > Incoming from Benjamin A. Okopnik:
> > >
> > > Except that the above won't translate the URL encoding, so you're still
> > > stuck with the same problem you came in with; from what I can tell from
> > > the code, it also throws away the "subject" parameter (or tries to.)
> >
> > Yeah, that was just me attempting to dredge up long atrophied awk skills.
>
> I was wondering. :) I was trying to figure out what that 'print ($2 %
> \?subject=[a-zA-Z0-9.,-]*)' gadget was supposed to do, and it was
Modulus of course. Sheesh. :-)
> > > echo "$@"|perl -MCGI -we'$q=new CGI(\*STDIN);"@{[$q->Vars=>]}" =~ /mailto:(.*)\?subject\s+(.*)/;system qq[/usr/X11/bin/xterm -e /usr/bin/mutt -s "$2" $1]'
> > > ''
> >
> > Ow! OW!?!
>
> Oh, no! Are *you* the baby Jesus??? I'm so, *SO* sorry...
Yabut, that's the kind of one-liner that makes python dweebs point and
say, "So there!"
> #!/usr/bin/perl -w
> # Created by Ben Okopnik on Sun Nov 13 17:24:14 EST 2005
> use strict;
Very pretty. However, called by Firefox, it doesn't seem to get $opts
right. It just pops open an rxvt with mutt running in it, no
To: or Subject: prompts. Run from the command line, it works
perfectly with:
echo
'mailto:tag at lists.linuxgazette.net?subject=%20Re%3A%20%5BLG%20120%5D%20help%20wanted%20%233' | \
/usr/local/bin/pinehelper.pl
but all that's ignored when called by Firefox. MozEX FAQ confirmed? :-)
#!/usr/bin/perl -w
#
## Created by Ben Okopnik on Sun Nov 13 17:24:14 EST 2005
#
use diagnostics;
use warnings;
use strict;
my ( @chunks, $k, $v, %header, $opts);
while ( <> ) {
chomp;
@chunks = split /[?&]/ if /^\s*mailto:/;
}
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 "/usr/bin/rxvt -fn '-*-*-medium-r-*-*-*-100-*-*-*-*-iso8859-1' -geometry 103x52-68+42 -T Mutt -e /usr/bin/mutt $opts"
or die "Blue? Aiiii!";
--
Any technology distinguishable from magic is insufficiently advanced.
(*) http://www.spots.ab.ca/~keeling
- -
More information about the TAG
mailing list