* gpgkeys_mailto.in: Set 'mail-from' as a keyserver-option, rather
authorDavid Shaw <dshaw@jabberwocky.com>
Tue, 5 May 2009 03:29:56 +0000 (03:29 +0000)
committerDavid Shaw <dshaw@jabberwocky.com>
Tue, 5 May 2009 03:29:56 +0000 (03:29 +0000)
than the ugly ?from= syntax.

keyserver/ChangeLog
keyserver/gpg2keys_mailto.in

index d9f5136..6d980fe 100644 (file)
@@ -1,3 +1,8 @@
+2009-05-04  David Shaw  <dshaw@jabberwocky.com>
+
+       * gpgkeys_mailto.in: Set 'mail-from' as a keyserver-option, rather
+       than the ugly ?from= syntax.
+
 2009-01-22  Werner Koch  <wk@g10code.com>
 
        * Makefile.am (gpg2keys_curl_LDADD, gpg2keys_hkp_LDADD): Add all
index 4e5d6bc..959f0e7 100755 (executable)
@@ -52,10 +52,6 @@ if(@ARGV)
     open(STDIN,$ARGV[0]) || die "Can't open input file $ARGV[0]\n";
 }
 
-($login,$name)=(getpwuid($<))[0,6];
-
-$from="$name <$login>";
-
 while(<STDIN>)
 {
     last if($_ eq "\n");
@@ -85,9 +81,24 @@ while(<STDIN>)
        {
            $verbose--;
        }
+       elsif($1=~/^mail-from=(.+)$/i)
+       {
+           $from=$1;
+       }
+       elsif($1=~/^no-mail-from$/i)
+       {
+           undef $from;
+       }
+
     }
 }
 
+if(!defined($from))
+{
+    ($login,$name)=(getpwuid($<))[0,6];
+    $from="$name <$login>";
+}
+
 $program="(unknown)" if(!defined($program));
 
 if(!defined($address))
@@ -96,29 +107,6 @@ if(!defined($address))
     exit(1);
 }
 
-# decode $address
-
-($address,$args)=split(/\?/,$address);
-
-if(defined($args))
-{
-    @pairs = split(/&/, $args);
-    foreach $pair (@pairs)
-    {
-       ($hdr, $val) = split(/=/, $pair);
-       $hdr =~ tr/+/ /;
-       $hdr =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
-       $val =~ tr/+/ /;
-       $val =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
-# we only handle "from" right now
-       if($hdr=~/^from$/i)
-       {
-           $from=$val;
-           last;
-       }
-    }
-}
-
 while(<STDIN>)
 {
     last if($_ eq "\n");