+ Make also-encrypt-to a list, add a commented stanza to the default
authormyon <myon@b513b33f-fedd-0310-b452-c3deb5f4c849>
Mon, 1 May 2006 11:12:35 +0000 (11:12 +0000)
committermyon <myon@b513b33f-fedd-0310-b452-c3deb5f4c849>
Mon, 1 May 2006 11:12:35 +0000 (11:12 +0000)
    config file (Closes: #325163).
  + Include mail-template in default config file, some minor syntax fixes.

git-svn-id: svn://svn.debian.org/pgp-tools/trunk@277 b513b33f-fedd-0310-b452-c3deb5f4c849

caff/caff
caff/caffrc.sample
debian/changelog

index 2fc095df8e093460da63584fc4a7bbccdd6179f1..cfb7d09e9e3eeca8a515b3e771d3df3694146ba4 100755 (executable)
--- a/caff/caff
+++ b/caff/caff
@@ -164,9 +164,9 @@ is set to.
 
 Path to your secret keyring.  Default: B<$HOME/.gnupg/secring.gpg>.
 
-=item B<also-encrypt-to> [keyid]
+=item B<also-encrypt-to> [list of keyids]
 
-An additional keyid to encrypt messages to. Default: none.
+Additional keyids to encrypt messages to. Default: none.
 
 =item B<gpg-sign-args> [string]
 
@@ -380,26 +380,36 @@ sub generate_config() {
                ($Cgecos,$Cemail,$Ckeys) = ('#','#','#');
        };
 
-       return <<EOT;
-# .caffrc -- vim:syntax=perl:
+       my $template = <<EOT;
+# .caffrc -- vim:ft=perl:
 # This file is in perl(1) format - see caff(1) for details.
 
-$Cgecos\$CONFIG{'owner'}       = '$gecos';
-$Cemail\$CONFIG{'email'}       = '$email';
+$Cgecos\$CONFIG{'owner'} = '$gecos';
+$Cemail\$CONFIG{'email'} = '$email';
+#\$CONFIG{'reply-to'} = 'foo\@bla.org';
 
-# you can get your long keyid from
+# You can get your long keyid from
 #   gpg --with-colons --list-key <yourkeyid|name|emailaddress..>
 #
-# if you have a v4 key, it will simply be the last 16 digits of
+# If you have a v4 key, it will simply be the last 16 digits of
 # your fingerprint.
 #
 # Example:
-#   \$CONFIG{'keyid'}       = [ qw{FEDCBA9876543210} ];
+#   \$CONFIG{'keyid'} = [ qw{FEDCBA9876543210} ];
 #  or, if you have more than one key:
-#   \$CONFIG{'keyid'}       = [ qw{0123456789ABCDEF 89ABCDEF76543210} ];
+#   \$CONFIG{'keyid'} = [ qw{0123456789ABCDEF 89ABCDEF76543210} ];
+$Ckeys\$CONFIG{'keyid'} = [ qw{@keys} ];
 
-$Ckeys\$CONFIG{'keyid'}       = [ qw{@keys} ];
+# Additionally encrypt messages sent to these keyids
+#\$CONFIG{'also-encrypt-to'} = [ qw{@keys} ];
+
+# Mail template to use for the encrypted part
+#\$CONFIG{'mail-template'} = << 'EOM';
 EOT
+
+       $template .= "#$_" foreach <DATA>;
+       $template .= "#EOM\n";
+       return $template;
 };
 
 sub check_executable($$) {
@@ -456,28 +466,9 @@ sub load_config() {
        $CONFIG{'key-files'} = () unless defined $CONFIG{'key-files'};
        $CONFIG{'mailer-send'} = [] unless defined $CONFIG{'mailer-send'};
        die ("$PROGRAM_NAME: mailer-send is not an array ref in $config.\n") unless (ref $CONFIG{'mailer-send'} eq 'ARRAY');
-       $CONFIG{'mail-template'} = <<'EOM' unless defined $CONFIG{'mail-template'};
-Hi,
-
-please find attached the user id{(scalar @uids >= 2 ? 's' : '')}.
-{foreach $uid (@uids) {
-    $OUT .= "\t".$uid."\n";
-};} of your key {$key} signed by me.
-
-Note that I did not upload your key to any keyservers.
-If you have multiple user ids, I sent the signature for each user id
-separately to that user id's associated email address. You can import
-the signatures by running each through `gpg --import`.
-
-If you want this new signature to be available to others, please upload
-it yourself. With GnuPG this can be done using
-       gpg --keyserver subkeys.pgp.net --send-key {$key}
-
-If you have any questions, don't hesitate to ask.
-
-Regards,
-{$owner}
-EOM
+       unless (defined $CONFIG{'mail-template'}) {
+               $CONFIG{'mail-template'} .= $_ foreach <DATA>;
+       }
 };
 
 sub make_gpg_fds() {
@@ -766,7 +757,14 @@ sub send_mail($$$@) {
                $gpg->options->meta_interactive( 0 );
                my ($inputfd, $stdoutfd, $stderrfd, $statusfd, $handles) = make_gpg_fds();
                $gpg->options->push_recipients( $key_id );
-               $gpg->options->push_recipients( $CONFIG{'also-encrypt-to'} ) if defined $CONFIG{'also-encrypt-to'};
+               if (defined $CONFIG{'also-encrypt-to'}) {
+                       if (ref($CONFIG{'also-encrypt-to'})) {
+                               $gpg->options->push_recipients($_)
+                                       foreach @{$CONFIG{'also-encrypt-to'}};
+                       } else { # old syntax
+                               $gpg->options->push_recipients($CONFIG{'also-encrypt-to'});
+                       }
+               }
                my $pid = $gpg->encrypt(handles => $handles);
                my ($stdout, $stderr, $status) = readwrite_gpg($message, $inputfd, $stdoutfd, $stderrfd, $statusfd);
                waitpid $pid, 0;
@@ -1301,3 +1299,29 @@ for my $keyid (@keyids_ok) {
        };
 
 };
+
+###########################
+# the default mail template
+###########################
+
+__DATA__
+Hi,
+
+please find attached the user id{(scalar @uids >= 2 ? 's' : '')}
+{foreach $uid (@uids) {
+    $OUT .= "\t".$uid."\n";
+};}of your key {$key} signed by me.
+
+If you have multiple user ids, I sent the signature for each user id
+separately to that user id's associated email address. You can import
+the signatures by running each through `gpg --import`.
+
+Note that I did not upload your key to any keyservers. If you want this
+new signature to be available to others, please upload it yourself.
+With GnuPG this can be done using
+       gpg --keyserver subkeys.pgp.net --send-key {$key}
+
+If you have any questions, don't hesitate to ask.
+
+Regards,
+{$owner}
index cadc44ee032ac7c5a70fc2de3f5674084e694b9f..dae022944b0311ca933ece70cfb64ce01f587d08 100644 (file)
@@ -1,5 +1,5 @@
 # $Id$
-# vim: syntax=perl
+# vim:ft=perl:
 
 $CONFIG{'owner'}       = 'John Doe';
 $CONFIG{'email'}       = 'user@example.com';
@@ -11,7 +11,7 @@ $CONFIG{'email'}       = 'user@example.com';
 # your fingerprint.
 
 $CONFIG{'keyid'}       = [ qw{DE7AAF6E94C09C7F 62AF4031C82E0039} ];
-$CONFIG{'also-encrypt-to'} = 'DE7AAF6E94C09C7F';
+$CONFIG{'also-encrypt-to'} = [ qw{DE7AAF6E94C09C7F} ];
 $CONFIG{'caffhome'}    = $ENV{'HOME'}.'/.caff';
 
 # The options below need not be changed for normal operation.
@@ -42,10 +42,10 @@ $CONFIG{'caffhome'}    = $ENV{'HOME'}.'/.caff';
 # $CONFIG{'mail-template'} = <<'EOM'
 # Hi,
 # 
-# please find attached the user id{(scalar @uids >= 2 ? 's' : '')}.
+# please find attached the user id{(scalar @uids >= 2 ? 's' : '')}
 # {foreach $uid (@uids) {
 #     $OUT .= "\t".$uid."\n";
-# };} of your key {$key} signed by me.
+# };}of your key {$key} signed by me.
 # 
 # Note that I did not upload your key to any keyservers.
 # If you have multiple user ids, I sent the signature for each user id
index 071c3b82d4b21c406decc9403c24b4f7226f14bc..76512855eae19d04a7952583729eb0bd6300a24a 100644 (file)
@@ -5,12 +5,15 @@ signing-party (0.4.6-1) unreleased; urgency=low
       (Closes: #356830).
     + Make local-user a config option, thanks to Michael C. Toren for the
       patch (Closes: #361316).
+    + Make also-encrypt-to a list, add a commented stanza to the default
+      config file (Closes: #325163).
+    + Include mail-template in default config file, some minor syntax fixes.
     + Bump copyright, use URL in User-Agent header.
   * pgp-clean:
     + Import caff's getopt handling.
     + Add option to allow exporting subkeys (Closes: #359698).
 
- -- Christoph Berg <myon@debian.org>  Sun, 30 Apr 2006 12:25:27 +0200
+ -- Christoph Berg <myon@debian.org>  Mon,  1 May 2006 13:06:14 +0200
 
 signing-party (0.4.5-1) unstable; urgency=low