Author: jamessan Date: 2009-05-28 23:11:39 +0000 (Thu, 28 May 2009) New Revision: 1891
Modified: trunk/debian/changelog trunk/scripts/bts.pl Log: bts: Only Cc [email protected] if we're reasonably sure we have an email body instead of simply control messages; i.e., if the user specifies the --force-interactive option or the --interactive option and chooses to edit the email body. (Closes: #530926) Modified: trunk/debian/changelog =================================================================== --- trunk/debian/changelog 2009-05-28 19:54:16 UTC (rev 1890) +++ trunk/debian/changelog 2009-05-28 23:11:39 UTC (rev 1891) @@ -15,6 +15,10 @@ * uscan: Log the correct filename when running the post-download action. Simplify the surrounding logic so the logging and command are less likely to get out of sync in the future. + * bts: Only Cc [email protected] if we're reasonably sure we have + an email body instead of simply control messages; i.e., if the user + specifies the --force-interactive option or the --interactive option and + chooses to edit the email body. (Closes: #530926) -- Adam D. Barratt <[email protected]> Thu, 21 May 2009 21:59:23 +0100 Modified: trunk/scripts/bts.pl =================================================================== --- trunk/scripts/bts.pl 2009-05-28 19:54:16 UTC (rev 1890) +++ trunk/scripts/bts.pl 2009-05-28 23:11:39 UTC (rev 1891) @@ -2271,6 +2271,15 @@ } } +sub generate_packages_cc { + my $ccs = ''; + if (keys %ccpackages && $packagesserver) { + $ccs .= join("\...@$packagesserver, ", sort (keys %ccpackages)) + . "\...@$packagesserver"; + } + return $ccs; +} + # Sends all cached mail to the bts (duh). sub mailbtsall { my $subject=shift; @@ -2281,10 +2290,9 @@ $charset =~ s/^ANSI_X3\.4-19(68|86)$/US-ASCII/; $subject = MIME_encode_mimewords($subject, 'Charset' => $charset); - if (keys %ccpackages && $packagesserver) { + if ($forceinteractive) { $ccemail .= ", " if length $ccemail; - $ccemail .= join("\...@$packagesserver, ", sort (keys %ccpackages)) - . "\...@$packagesserver"; + $ccemail .= generate_packages_cc(); } if ($ccsecurity) { my $comma = ""; @@ -2377,6 +2385,7 @@ my ($header, $body) = @_; $body = edit($body) if $forceinteractive; + my $setHeader = 0; if ($interactive) { while(1) { print "\n", $header, "\n", $body, "\n---\n"; @@ -2388,6 +2397,20 @@ } elsif (/^(y|$)/i) { last; } elsif (/^e/i) { + # Since the user has chosen to edit the message, we go ahead + # and add the $ccpackages Ccs (if they haven't already been + # added due to $forceinteractive). + if (!$forceinteractive && !$setHeader) { + $setHeader = 1; + my $ccs = generate_packages_cc(); + if ($header =~ m/^Cc: (.*?)$/m) { + $ccs = "$1, $ccs"; + $header =~ s/^Cc: .*?$/Cc: $ccs/m; + } + else { + $header =~ s/^(To: .*?)$/$1\nCc: $ccs/m; + } + } $body = edit($body); } } @@ -2399,7 +2422,7 @@ sub addfooter() { my $body = shift; - if ($forceinteractive) { + if ($forceinteractive) { $body .= "thanks\n"; if (-r $ENV{'HOME'} . "/.signature") { if (open SIG, "<", $ENV{'HOME'} . "/.signature") { -- To unsubscribe, send mail to [email protected].
