use Debbugs::Common qw(:misc :util);
use Debbugs::Status qw(splitpackages isstrongseverity);
+use Debbugs::Packages qw(binary_to_source);
+
use Debbugs::Mail qw(get_addresses);
use Carp;
actions_taken => {type => HASHREF,
default => {},
},
+ unknown_packages => {type => HASHREF,
+ default => {},
+ },
},
);
for my $data (@{$param{data}}) {
add_recipients(data => $data,
map {exists $param{$_}?($_,$param{$_}):()}
- qw(recipients debug transcript actions_taken)
+ qw(recipients debug transcript actions_taken unknown_packages)
);
}
return;
for my $p (splitpackages($param{data}{package})) {
$p = lc($p);
if (defined $config{subscription_domain}) {
- my @source_packages = binarytosource($p);
+ my @source_packages = binary_to_source(binary => $p,
+ source_only => 1,
+ );
if (@source_packages) {
for my $source (@source_packages) {
_add_address(recipients => $param{recipients},
type => 'bcc',
);
}
- if (defined(getmaintainers()->{$p})) {
- $addmaint= getmaintainers()->{$p};
- print {$param{debug}} "MR|$addmaint|$p|$ref|\n";
- _add_address(recipients => $param{recipients},
- address => $addmaint,
- reason => $p,
- bug_num => $param{data}{bug_num},
- type => 'cc',
- );
- print {$param{debug}} "maintainer add >$p|$addmaint<\n";
+ my @maints = package_maintainer(binary => $p);
+ if (@maints) {
+ print {$param{debug}} "MR|".join(',',@maints)."|$p|$ref|\n";
+ _add_address(recipients => $param{recipients},
+ address => \@maints,
+ reason => $p,
+ bug_num => $param{data}{bug_num},
+ type => 'cc',
+ );
+ print {$param{debug}} "maintainer add >$p|".join(',',@maints)."<\n";
}
- else {
+ else {
print {$param{debug}} "maintainer none >$p<\n";
- print {$param{transcript}} "Warning: Unknown package '$p'\n";
+ if (not exists $param{unknown_packages}{$p}) {
+ print {$param{transcript}} "Warning: Unknown package '$p'\n";
+ $param{unknown_packages}{$p} = 1;
+ }
print {$param{debug}} "MR|unknown-package|$p|$ref|\n";
_add_address(recipients => $param{recipients},
address => $config{unknown_maintainer_email},
if (defined $config{bug_subscription_domain} and
length $config{bug_subscription_domain}) {
_add_address(recipients => $param{recipients},
- address => 'bug='.$param{data}{bug_num}.'@'.
+ address => 'bugs='.$param{data}{bug_num}.'@'.
$config{bug_subscription_domain},
reason => "bug $param{data}{bug_num}",
bug_num => $param{data}{bug_num},
If you specify one of C<bcc>, C<cc>, or C<to>, you will receive only a
LIST of recipients which the main should be Bcc'ed, Cc'ed, or To'ed
respectively. By default, a LIST with keys bcc, cc, and to is returned
-with ARRAYREF values correponding to the users to whom a message
+with ARRAYREF values corresponding to the users to whom a message
should be sent.
=over
$level = 'cc';
}
}
- # strip out all non-word non-spaces
- $reason =~ s/[^\ \w]//g;
+ # RFC 2822 comments cannot contain specials and
+ # unquoted () or \; there's no reason for us to allow
+ # insane things here, though, so we restrict this even
+ # more to 20-7E ( -~)
+ $reason =~ s/\\/\\\\/g;
+ $reason =~ s/([\)\(])/\\$1/g;
+ $reason =~ s/[^\x20-\x7E]//g;
push @reasons, $reason . ' for {'.join(',',@bugs).'}';
}
if ($param{address_only}) {
}
for (qw(to cc bcc)) {
if ($param{$_}) {
- return @{$final_recipients{$_}};
+ if (exists $final_recipients{$_}) {
+ return @{$final_recipients{$_}||[]};
+ }
+ return ();
}
}
return %final_recipients;