88
89
--smtp-ssl If set, connects to the SMTP server using SSL.
90
91
+ --suppress-cc Suppress the specified category of auto-CC. The category
92
+ can be one of 'author' for the patch author, 'self' to
93
+ avoid copying yourself, 'sob' for Signed-off-by lines,
94
+ 'cccmd' for the output of the cccmd, or 'all' to suppress
95
+ all of these.
96
+
97
--suppress-from Suppress sending emails to yourself. Defaults to off.
98
99
--thread Specify that the "In-Reply-To:" header should be set on all
186
my ($smtp_server, $smtp_server_port, $smtp_authuser, $smtp_authpass, $smtp_ssl);
187
my ($identity, $aliasfiletype, @alias_files, @smtp_host_parts);
188
my ($no_validate);
189
+my (@suppress_cc);
190
191
my %config_bool_settings = (
192
"thread" => [\$thread, 1],
193
"chainreplyto" => [\$chain_reply_to, 1],
187
- "suppressfrom" => [\$suppress_from, 0],
188
- "signedoffcc" => [\$signed_off_cc, 1],
194
+ "suppressfrom" => [\$suppress_from, undef],
195
+ "signedoffcc" => [\$signed_off_cc, undef],
196
"smtpssl" => [\$smtp_ssl, 0],
197
);
198
206
"aliasfiletype" => \$aliasfiletype,
207
"bcc" => \@bcclist,
208
"aliasesfile" => \@alias_files,
209
+ "suppresscc" => \@suppress_cc,
210
);
211
212
# Begin by accumulating all the variables (defined above), that we will end up
229
"quiet" => \$quiet,
230
"cc-cmd=s" => \$cc_cmd,
231
"suppress-from!" => \$suppress_from,
232
+ "suppress-cc=s" => \@suppress_cc,
233
"signed-off-cc|signed-off-by-cc!" => \$signed_off_cc,
234
"dry-run" => \$dry_run,
235
"envelope-sender=s" => \$envelope_sender,
275
${$setting->[0]} = $setting->[1] unless (defined (${$setting->[0]}));
276
}
277
278
+# Set CC suppressions
279
+my(%suppress_cc);
280
+if (@suppress_cc) {
281
+ foreach my $entry (@suppress_cc) {
282
+ die "Unknown --suppress-cc field: '$entry'\n"
283
+ unless $entry =~ /^(all|cccmd|cc|author|self|sob)$/;
284
+ $suppress_cc{$entry} = 1;
285
+ }
286
+}
287
+
288
+if ($suppress_cc{'all'}) {
289
+ foreach my $entry (qw (ccmd cc author self sob)) {
290
+ $suppress_cc{$entry} = 1;
291
+ }
292
+ delete $suppress_cc{'all'};
293
+}
294
+
295
+# If explicit old-style ones are specified, they trump --suppress-cc.
296
+$suppress_cc{'self'} = $suppress_from if defined $suppress_from;
297
+$suppress_cc{'sob'} = $signed_off_cc if defined $signed_off_cc;
298
+
299
+# Debugging, print out the suppressions.
300
+if (0) {
301
+ print "suppressions:\n";
302
+ foreach my $entry (keys %suppress_cc) {
303
+ printf " %-5s -> $suppress_cc{$entry}\n", $entry;
304
+ }
305
+}
306
+
307
my ($repoauthor) = $repo->ident_person('author');
308
my ($repocommitter) = $repo->ident_person('committer');
309
749
750
} elsif (/^(Cc|From):\s+(.*)$/) {
751
if (unquote_rfc2047($2) eq $sender) {
714
- next if ($suppress_from);
752
+ next if ($suppress_cc{'self'});
753
}
754
elsif ($1 eq 'From') {
755
($author, $author_encoding)
756
= unquote_rfc2047($2);
757
+ next if ($suppress_cc{'author'});
758
+ } else {
759
+ next if ($suppress_cc{'cc'});
760
}
761
printf("(mbox) Adding cc: %s from line '%s'\n",
762
$2, $_) unless $quiet;
783
# line 2 = subject
784
# So let's support that, too.
785
$input_format = 'lots';
745
- if (@cc == 0) {
786
+ if (@cc == 0 && !$suppress_cc{'cc'}) {
787
printf("(non-mbox) Adding cc: %s from line '%s'\n",
788
$_, $_) unless $quiet;
789
800
}
801
} else {
802
$message .= $_;
762
- if (/^(Signed-off-by|Cc): (.*)$/i && $signed_off_cc) {
803
+ if (/^(Signed-off-by|Cc): (.*)$/i) {
804
+ next if ($suppress_cc{'sob'});
805
my $c = $2;
806
chomp $c;
765
- next if ($c eq $sender and $suppress_from);
807
+ next if ($c eq $sender and $suppress_cc{'self'});
808
push @cc, $c;
809
printf("(sob) Adding cc: %s from line '%s'\n",
810
$c, $_) unless $quiet;
813
}
814
close F;
815
774
- if (defined $cc_cmd) {
816
+ if (defined $cc_cmd && !$suppress_cc{'cccmd'}) {
817
open(F, "$cc_cmd $t |")
818
or die "(cc-cmd) Could not execute '$cc_cmd'";
819
while(<F>) {