if ($DEBUG > 0) {
$debugfh = \*STDERR;
}
+binmode($debugfh,':raw:encoding(UTF-8)');
# these are the valid bug addresses
my %baddress = (B => 'submit',
my @common_headers;
for my $hdr (@headerlines) {
+ my $orig_hdr = $hdr;
$hdr = decode_rfc1522($hdr);
$_ = $hdr;
s/\n\s/ /g;
finish() if m/^x-loop: (\S+)$/i && $1 eq "$gMaintainerEmail";
my $ins = !m/^subject:/i && !m/^reply-to:/i && !m/^return-path:/i
&& !m/^From / && !m/^X-Debbugs-/i;
- $fwd .= $hdr."\n" if $ins;
+ $fwd .= encode_utf8($hdr)."\n" if $ins;
# print {$debugfh} ">$_<\n";
if (s/^(\S+):\s*//) {
my $v = lc $1;
++$i while $msg[$i] =~ /./;
$fwd .= join("\n",@msg[$i..$#msg]);
+binmode($debugfh,':raw');
print {$debugfh} "***\n$fwd\n***\n";
+binmode($debugfh,':raw:encoding(UTF-8)');
if (defined $header{'resent-from'} && !defined $header{'from'}) {
$header{'from'} = $header{'resent-from'};
my $ref=-1;
# remove Re: from the subject line
$subject =~ s/^Re:\s*//i;
-# remove remaining mailing list name markers from the subject line
-$subject =~ s/^\[.*\]\s*//i;
+# remove remaining mailing list name markers from the subject line if
+# this appears to be a message that has traversed a mailing list
+if (exists $header{'list-id'} or exists $header{'list-subscribe'} or
+ (exists $header{'precedence'} and defined $header{'precedence'} and
+ $header{'precedence'} eq 'bulk') or
+ exists $header{'mailing-list'} or exists $header{'list-processor-version'}
+ ){
+ # if a mailing list didn't match any of the above, it's probably
+ # so horribly configured that we wouldn't be able to figure it out
+ # anyway.
+ $subject =~ s/^\[.*\]\s*//i;
+}
$_= $subject."\n";
if (not defined $tryref and m/^Bug ?\#(\d+)\D/i) {
$tryref = $1 if $1 > 0;
}
}
else {
+ print {$transcript} "Unknown command or malformed arguments to command.\n\n";
$errors++;
if (++$unknowns >= 5) {
print {$transcript} "Too many unknown commands, stopping here.\n\n";
write_log_records(logfh => $logfh,
records => {text => stripbccs($msg),
type => 'recips',
- recips => [@{$recips}],
+ recips => [map {encode_utf8($_)} @{$recips}],
},
);
if (ref($bcc)) {