use warnings;
use strict;
+use POSIX qw(strftime locale_h);
+setlocale(LC_TIME, "C");
use Debbugs::Config qw(:globals :config);
use Debbugs::Status qw(splitpackages);
use Debbugs::CGI qw(html_escape);
-use Debbugs::Control qw(:all);
+use Debbugs::Control qw(:all valid_usertag);
use Debbugs::Control::Service qw(:all);
use Debbugs::Log qw(:misc);
use Debbugs::Text qw(:templates);
use Scalar::Util qw(looks_like_number);
-use List::Util qw(first);
+use List::AllUtils qw(first uniqnum);
use Mail::RFC822::Address;
use Encode qw(decode encode);
} elsif (m/^subscribe/i) {
print {$transcript} <<END;
There is no $gProject $gBug mailing list. If you wish to review bug reports
-please do so via http://$gWebDomain/ or ask this mail server
+please do so via $gWebDomain or ask this mail server
to send them to you.
soon: MAILINGLISTS_TEXT
END
my %chtags;
if (defined $tags and length $tags) {
for my $t (split /[,\s]+/, $tags) {
- if ($t =~ m/^[a-zA-Z0-9.+\@-]+$/) {
+ if (valid_usertag($t)) {
$chtags{$t} = 1;
} else {
push @badtags, $t;
} else {
print {$transcript} "Usertags were: " . join(" ", @oldtags) . ".\n";
}
- print {$transcript} "Usertags are now: " . join(" ", @newtags) . ".\n";
+ if (@newtags == 0) {
+ print {$transcript} "There are now no usertags set.\n";
+ } else {
+ print {$transcript} "Usertags are now: " . join(" ", @newtags) . ".\n";
+ }
Debbugs::User::write_usertags(\%ut, $user);
}
} elsif (!$control) {
last;
}
} else {
+ print {$transcript} "Unknown command or malformed arguments to command.\n";
$errors++;
if (++$unknowns >= 5) {
print {$transcript} "Too many unknown commands, stopping here.\n\n";
}
# Error text here advertises how many errors there were
-my $error_text = $errors > 0 ? " (with $errors errors)":'';
+my $error_text = $errors > 0 ? " (with $errors error" . ($errors > 1 ? "s" : "") . ")" : "";
my @common_headers;
push @common_headers, 'X-Loop',$gMaintainerEmail;
$temp_transcript = decode("utf8",$temp_transcript,Encode::FB_CROAK);
};
my $reply =
- create_mime_message([From => "$gMaintainerEmail ($gProject $gBug Tracking System)",
+ create_mime_message([From => qq("$gProject $gBug Tracking System" <$gMaintainerEmail>),
To => $replyto,
@maintccs ? (Cc => join(', ',@maintccs)):(),
Subject => "Processed${error_text}: $header{subject}",
my $variables = {config => \%config,
defined($ref)?(ref => $ref):(),
defined($data)?(data => $data):(),
- refs => [map {exists $clonebugs{$_}?$clonebugs{$_}:$_} keys %bug_affected],
+ refs => [sort
+ uniqnum(defined($ref)?($ref):(),
+ map {exists $clonebugs{$_}?$clonebugs{$_}:$_}
+ keys %bug_affected)],
%{$extra_var},
};
- my $hole_var = {'&bugurl' =>
- sub{"$_[0]: ".
- 'http://'.$config{cgi_domain}.'/'.
- Debbugs::CGI::bug_links(bug=>$_[0],
- links_only => 1,
- );
- }
- };
return fill_in_template(template => $template,
variables => $variables,
- hole_var => $hole_var,
+ output_type => 'text',
);
}
close(D);
print {$transcript} "Sending $description in separate message.\n";
&sendmailmessage(<<END.$doc,$replyto);
-From: $gMaintainerEmail ($gProject $gBug Tracking System)
+From: "$gProject $gBug Tracking System" <$gMaintainerEmail>
To: $replyto
Subject: $gProject $gBug help: $description
References: $header{'message-id'}
sub sendlynxdocraw {
my ($relpath,$description) = @_;
$doc='';
- open(L,"lynx -nolist -dump http://$gCGIDomain/\Q$relpath\E 2>&1 |") || die "fork for lynx: $!";
+ open(L,"lynx -nolist -dump $gCGIDomain/\Q$relpath\E 2>&1 |") || die "fork for lynx: $!";
while(<L>) { $doc.=$_; }
$!=0; close(L);
if ($? == 255 && $doc =~ m/^\n*lynx: Can\'t access start file/) {
} else {
print {$transcript} "Sending $description.\n";
&sendmailmessage(<<END.$doc,$replyto);
-From: $gMaintainerEmail ($gProject $gBug Tracking System)
+From: "$gProject $gBug Tracking System" <$gMaintainerEmail>
To: $replyto
Subject: $gProject $gBugs information: $description
References: $header{'message-id'}
}
print {$transcript} "Sending $description.\n";
&sendmailmessage(<<END.$doc,$replyto);
-From: $gMaintainerEmail ($gProject $gBug Tracking System)
+From: "$gProject $gBug Tracking System" <$gMaintainerEmail>
To: $replyto
Subject: $gProject $gBugs information: $description
References: $header{'message-id'}