use Debbugs::CGI qw(html_escape);
use Debbugs::Control qw(:archive :log);
use Debbugs::Log qw(:misc);
+use Debbugs::Text qw(:templates);
+
+use Mail::RFC822::Address;
$lib_path = $gLibPath;
require "$lib_path/errorlib";
my (%bug_affected);
if ($entity and $entity->head->tags) {
- @headerlines = @{$entity->head->header};
- chomp @headerlines;
+ # Use map instead of chomp to also kill \r.
+ @headerlines = map {s/\r?\n?$//; $_;}
+ @{$entity->head->header};
my $entity_body = getmailbody($entity);
- @bodylines = $entity_body ? $entity_body->as_lines() : ();
- chomp @bodylines;
+ @bodylines = map {s/\r\n$//; $_;}
+ $entity_body ? $entity_body->as_lines() : ();
} else {
# Legacy pre-MIME code, kept around in case MIME::Parser fails.
my $i;
my $fuckheads = "(" . join("|", @gExcludeFromControl) . ")";
if (@gExcludeFromControl and $replyto =~ m/$fuckheads/) {
- &transcript("You have been specifically excluded from using the\ncontrol interface.\n\n");
- &transcript("Have a nice day\n\n.");
+ &transcript(fill_template('mail/excluded_from_control'));
$quickabort = 1;
}
next;
}
if (not $indicated_user and defined $user) {
- &transcript("User is $user");
+ &transcript("User is $user\n");
$indicated_user = 1;
}
while (++$procline <= $#bodylines) {
$indicated_user = 1;
} elsif (&setbug) {
if (not $indicated_user and defined $user) {
- &transcript("User is $user");
+ &transcript("User is $user\n");
$indicated_user = 1;
}
&nochangebug;
} while (&getnextbug);
}
}
- } elsif (m[^notfound\s+\#?(-?\d+)
- (?:\s+(?:$config{package_name_re}\/)?
- ($config{package_version_re}))$]ix) {
+ } elsif (m[^notfound\s+\#?(-?\d+)\s+
+ ((?:$config{package_name_re}\/)?
+ \S+)\s*$]ix) {
$ok++;
$ref= $1;
$version= $2;
if (&setbug) {
- $action= "$gBug marked as not found in version $version.";
+ $action= "$gBug no longer marked as found in version $version.";
if (length($data->{done})) {
$extramessage= "(By the way, this $gBug is currently marked as done.)\n";
}
}
elsif (m[^notfixed\s+\#?(-?\d+)\s+
((?:$config{package_name_re}\/)?
- $config{package_version_re})\s*$]ix) {
+ \S+)\s*$]ix) {
$ok++;
$ref= $1;
$version= $2;
if (&setbug) {
$action=
defined($version) ?
- "$gBug marked as not fixed in version $version." :
+ "$gBug no longer marked as fixed in version $version." :
"$gBug reopened.";
do {
&addmaintainers($data);
if ($ref =~ m/^-\d+$/ && defined $clonebugs{$ref}) {
$ref = $clonebugs{$ref};
}
- if (&getbug) {
+ if (not Mail::RFC822::Address::valid($newsubmitter)) {
+ transcript("$newsubmitter is not a valid e-mail address; not changing submitter\n");
+ $errors++;
+ }
+ elsif (&getbug) {
if (&checkpkglimit) {
&foundbug;
&addmaintainers($data);
$data->{keywords} =~ s/\s*$//;
} while (&getnextbug);
}
- } elsif (m/^(un)?block\s+\#?(-?\d+)\s+(by|with)\s+\s*(\S.*)?$/i) {
+ } elsif (m/^(un)?block\s+\#?(-?\d+)\s+(by|with)\s+(\S.*)?$/i) {
$ok++;
my $bugnum = $2; my $blockers = $4;
$addsub = "add";
$midix++;
}
+sub fill_template{
+ my ($template,$extra_var) = @_;
+ $extra_var ||={};
+ my $variables = {config => \%config,
+ defined($ref)?(ref => $ref):(),
+ defined($data)?(data => $data):(),
+ %{$extra_var},
+ };
+ my $hole_var = {'&bugurl' =>
+ sub{"$_[0]: ".
+ 'http://'.$config{cgi_domain}.'/'.
+ Debbugs::CGI::bug_url($_[0]);
+ }
+ };
+ return fill_in_template(template => $template,
+ variables => $variables,
+ hole_var => $hole_var,
+ );
+}
+
+=head2 message_body_template
+
+ message_body_template('mail/ack',{ref=>'foo'});
+
+Creates a message body using a template
+
+=cut
+
+sub message_body_template{
+ my ($template,$extra_var) = @_;
+ $extra_var ||={};
+ my $body = fill_template($template,$extra_var);
+ return fill_template('mail/message_body',
+ {%{$extra_var},
+ body => $body,
+ },
+ );
+}
+
sub sendhelp {
&sendtxthelpraw("bug-log-mailserver.txt","instructions for request\@$gEmailDomain");
&sendtxthelpraw("bug-maint-mailcontrol.txt","instructions for control\@$gEmailDomain")