Package: signing-party
Version: 0.4.7-1
Severity: wishlist
Hi!
Currently the -m and -M options are biting each other quite a bit. If
you have set no-mail in your config file you can't make caff send mails
at all with the commandline option, which is quite unconvenient.
I have produced a patch for caff that would turn -m into a quad-option
like with mutt config where you can define its behavior: yes for always
send, no for never send, and ask-yes/ask-no for asking with according
default value.
I hope this is considered helpful, I have tried to not break backward
compatibility too much - unfortunately it wasn't completely possible: If
you put multiple short options mixed and m isn't the last it takes the
rest as value which it checks against the quad option. This is the only
drawback from this patch, I didn't like the idea for using yet another
switch for that.
So long,
Alfie
--
Wo wir schon bei Schnäppchenbestrafungen sind: ich finde § 307 StGB hat ein
recht ordentliches Preis-Leistungs-Verhältnis. Soviel Bums für sowenig Strafe
gibt sonst nirgendwo.
-- Holger Lembke in de.soc.recht.misc
Index: caff
===================================================================
--- caff (Revision 297)
+++ caff (Arbeitskopie)
@@ -40,7 +40,7 @@
=over
-=item B<caff> [-eEmMRS] [-u I<yourkeyid>] I<keyid> [I<keyid> ..]
+=item B<caff> [-eERS] [-m I<yes|ask-yes|ask-no|no>] [-u I<yourkeyid>] I<keyid>
[I<keyid> ..]
=back
@@ -66,14 +66,10 @@
Do not export old signatures. Default is to ask the user for each old
signature.
-=item B<-m>, B<--mail>
+=item B<-m>, B<--mail> I<yes|ask-yes|ask-no|no>
-Send mail after signing. Default is to ask the user for each uid.
+Wether to send mail after signing. Default is to ask with a default value of
yes.
-=item B<-M>, B<--no-mail>
-
-Do not send mail after signing. Default is to ask the user for each uid.
-
=item B<-R>, B<--no-download>
Do not retrieve the key to be signed from a keyserver.
@@ -211,15 +207,12 @@
=head2 Mail settings
-=item B<mail> [boolean]
+=item B<mail> [yes|ask-yes|ask-no|no]
-Do not prompt for sending mail, just do it. Default: B<0>.
+Wether to send mails. This is a quad-option, with which you can set the
+bahavior: yes always sends, no never sends; ask-yes and ask-no asks with
+according defaults for the question. Default: B<ask-yes>.
-=item B<no-mail> [boolean]
-
-Do not prompt for sending mail. The messages are still written to
-$CONFIG{caffhome}/keys/. Default: B<0>.
-
=item B<mail-template> [string]
Email template which is used as the body text for the email sent out
@@ -656,7 +649,7 @@
sub usage($$) {
my ($fd, $exitcode) = @_;
version($fd);
- print $fd "Usage: $PROGRAM_NAME [-eEmMRS] [-u <yourkeyid>] <keyid>
[<keyid> ...]\n";
+ print $fd "Usage: $PROGRAM_NAME [-eERS] [-m <yes|ask-yes|ask-no|no>]
[-u <yourkeyid>] <keyid> [<keyid> ...]\n";
print $fd "Consult the manual page for more information.\n";
exit $exitcode;
};
@@ -878,8 +871,8 @@
'--export-old' => \$params->{'export-old'},
'-E' => \$params->{'no-export-old'},
'--no-export-old' => \$params->{'no-export-old'},
- '-m' => \$params->{'mail'},
- '--mail' => \$params->{'mail'},
+ '-m:s' => \$params->{'mail'},
+ '--mail:s' => \$params->{'mail'},
'-M' => \$params->{'no-mail'},
'--no-mail' => \$params->{'no-mail'},
'-R' => \$params->{'no-download'},
@@ -897,15 +890,21 @@
version(\*STDOUT);
exit(0);
};
+
usage(\*STDERR, 1) unless scalar @ARGV >= 1;
$CONFIG{'local-user'} = $params->{'local-user'} if defined
$params->{'local-user'};
$CONFIG{'no-download'} = $params->{'no-download'} if defined
$params->{'no-download'};
-$CONFIG{'no-mail'} = $params->{'no-mail'} if defined
$params->{'no-mail'};
-$CONFIG{'mail'} = $params->{'mail'} if defined $params->{'mail'};
+$CONFIG{'no-mail'} = $params->{'no-mail'} if defined
$params->{'no-mail'} || (defined $params->{'mail'} && $params->{'mail'} eq
'no');
+$CONFIG{'mail'} = defined $params->{'mail'} ? $params->{'mail'} :
'ask-yes';
$CONFIG{'no-sign'} = $params->{'no-sign'} if defined
$params->{'no-sign'};
push @{$CONFIG{'key-files'}}, @{$params->{'key-files'}} if defined
$params->{'key-files'};
+if ($CONFIG{'mail'} !~ /^(?:(?:ask-)?(?:yes|no))?$/) {
+ print STDERR "Invalid value for -m: " . $CONFIG{'mail'} . ". Allowed
values: <yes|ask-yes|ask-no|no>\n";
+ usage(\*STDERR, 1);
+};
+
for my $keyid (@ARGV) {
$keyid =~ s/^0x//i;
if ($keyid =~ /^[A-F0-9]{32}$/i) {
@@ -1302,7 +1301,7 @@
if (!$uid->{'is_uat'} && ($uid->{'text'} =~ /@/)) {
my $address = $uid->{'text'};
$address =~ s/.*<(.*)>.*/$1/;
- if (ask("Mail signature for $uid->{'text'} to
'$address'?", 1, $CONFIG{'mail'})) {
+ if (ask("Mail signature for $uid->{'text'} to
'$address'?", $CONFIG{'mail'} !~ /^ask-no$/, $CONFIG{'mail'} =~ /^yes$/)) {
my $mail = send_mail($address,
$can_encrypt, $longkeyid, $uid, @attached);
my $keydir = "$KEYSBASE/$DATE_STRING";