Make the text that caff sends a config option.
authorweasel <weasel@b513b33f-fedd-0310-b452-c3deb5f4c849>
Wed, 29 Jun 2005 14:37:05 +0000 (14:37 +0000)
committerweasel <weasel@b513b33f-fedd-0310-b452-c3deb5f4c849>
Wed, 29 Jun 2005 14:37:05 +0000 (14:37 +0000)
Thanks to Elmar Hoffmann

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

caff/README
caff/caff
debian/changelog
debian/control

index 95898d0dcc3bff0643b417bddca0d6ba9dd7774f..2af310ece74b779bee09a13be1452741f656514d 100644 (file)
@@ -33,7 +33,7 @@ systems.
 
 
 
-Dependencies: gnupg (>= 1.3.92), perl, libgnupg-interface-perl, libmime-perl, libmailtools-perl (>= 1.62), mailx
+Dependencies: gnupg (>= 1.3.92), perl, libgnupg-interface-perl, libtext-template-perl, libmime-perl, libmailtools-perl (>= 1.62), mailx
 
 
 INSTALLATION NOTES
index 009b0b5683d3234b6fece6512956d5eb6ab8e432..0fb709f0b919c7f2c89e3d9c42e6eab1183d4f8c 100755 (executable)
--- a/caff/caff
+++ b/caff/caff
@@ -150,6 +150,28 @@ Default: B<0>.
 
 If true, then skip the signing step. Default: B<0>.
 
+=item B<mail-template> [string]
+
+Email template which is used as the body text for the email sent out.
+instead of the default text if specified. The following perl variables
+can be used in the template:
+
+=over
+
+=item B<{owner}> [string]
+
+Your name as specified in the L<B<owner>|/item_owner__5bstring_5d> setting.
+
+=item B<{key}> [string]
+
+The keyid of the key you signed.
+
+=item B<{@uids}> [array]
+
+The UIDs for which signatures are included in the mail.
+
+=back
+
 =back
 
 =head1 AUTHOR
@@ -167,6 +189,7 @@ use IO::Handle;
 use English;
 use File::Path;
 use File::Temp qw{tempdir};
+use Text::Template;
 use MIME::Entity;
 use Fcntl;
 use IO::Select;
@@ -202,6 +225,24 @@ sub load_config() {
        $CONFIG{'secret-keyring'} = $ENV{'HOME'}.'/.gnupg/secring.gpg' unless defined $CONFIG{'secret-keyring'};
        $CONFIG{'no-download'} = 0 unless defined $CONFIG{'no-download'};
        $CONFIG{'no-sign'} = 0 unless defined $CONFIG{'no-sign'};
+       $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 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
 };
 
 sub notice($) {
@@ -402,24 +443,18 @@ sub export_key($$) {
 sub send_mail($$$@) {
        my ($address, $can_encrypt, $key_id, @keys) = @_;
 
-       my $message = "Hi,\n\n";
+       my $template = Text::Template->new(TYPE => 'STRING', SOURCE => $CONFIG{'mail-template'})
+           or die "Error creating template: $Text::Template::ERROR";
 
-       $message .= 'please find attached the user id'.(scalar @keys >= 2 ? 's' : '')."\n";
+       my @uids;
        for my $key (@keys) {
-               $message .= "\t".$key->{'text'}."\n";
+           push @uids, $key->{'text'};
        };
-       $message .= qq{of your key $key_id signed by me.
-
-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_id
+       my $message = $template->fill_in(HASH => { key => $key_id,
+                                                  uids => \@uids,
+                                                  owner => $CONFIG{'owner'}})
+           or die "Error filling template in: $Text::Template::ERROR";
 
-If you have any questions, don't hesitate to ask.
-
-Regards,
-$CONFIG{'owner'}
-};
        my $message_entity = MIME::Entity->build(
                Type        => "text/plain",
                Charset     => "utf-8",
index f5043799fbcf75120933d416ac4c4fe1d046c589..7915c7270e14c40e48ac889f08e930d794f626ed 100644 (file)
@@ -1,3 +1,9 @@
+signing-party (0.4.1-XXX) unreleased; urgency=low
+
+  * Depend on libtext-template-perl as caff needs it.
+
+ -- Peter Palfrader <weasel@debian.org>  Wed, 29 Jun 2005 16:36:08 +0200
+
 signing-party (0.4.1-1) unstable; urgency=low
 
   * gpg-key2ps now works with revoked subkeys, thanks Christof Douma
index a05005d5500ce9b951fbc99c0074dcab7d1be026..c13da1b2af51eb2b19998b110543fe68b8ba2e00 100644 (file)
@@ -8,7 +8,7 @@ Standards-Version: 3.6.2
 
 Package: signing-party
 Architecture: all
-Depends: gnupg (>= 1.3.92), perl, libgnupg-interface-perl, libmime-perl, libmailtools-perl (>= 1.62), mailx, libpaper-utils (>= 1.1.13)
+Depends: gnupg (>= 1.3.92), perl, libgnupg-interface-perl, libtext-template-perl, libmime-perl, libmailtools-perl (>= 1.62), mailx, libpaper-utils (>= 1.1.13)
 Recommends: exim4 | mail-transport-agent, libtext-iconv-perl | libintl-perl | recode
 Description: tools for signing GnuPG keys
  signing-party is a collection for all kinds of PGP/GnuPG related things,