(?:Acknowledgement|Reply|Information|Report|Notification)/m ? 'infmessage':'msgreceived';
$output .= $text;
# Link to forwarded http:// urls in the midst of the report
# (even though these links already exist at the top)
- $output =~ s,((?:ftp|http|https)://[\S~-]+?/?)((?:[\)\'\:\.\,]|\&\#39;)?(?:\s|\.<|$)),$1$2,go;
+ $output =~ s,((?:ftp|http|https)://[\S~-]+?/?)((?:[\)\'\:\.\,]|\&\#39;|\"\;)?
+ (?:\s|\.<|$)),$1$2,gxo;
# Add links to the cloned bugs
$output =~ s{(Bug )(\d+)( cloned as bugs? )(\d+)(?:\-(\d+)|)}{$1.bug_links(bug=>$2).$3.bug_links(bug=>(defined $5)?[$4..$5]:$4)}eo;
# Add links to merged bugs
@@ -386,8 +394,10 @@ sub handle_record{
{$1.$2.(bug_links(bug=>$3)).$4.
english_join([map {bug_links(bug=>$_)} (split /\,?\s+(?:and\s+)?/, $5)])}eo;
# Add links to reassigned packages
- $output =~ s{(Bug reassigned from package (?:[\`']|\&\#39;))([^']+?)((?:'|\&\#39;) to (?:[\`']|\&\#39;))([^']+?)((?:'|\&\#39;))}
- {$1.q($2).$3.q($4).$5}eo;
+ $output =~ s{($config{bug}\sreassigned\sfrom\spackage\s(?:[\`']|\&\#39;))([^']+?)((?:'|\&\#39;|\"\;)
+ \sto\s(?:[\`']|\&\#39;|\"\;))([^']+?)((?:'|\&\#39;|\"\;))}
+ {$1.package_links(package=>$2).$3.
+ package_links(package=>$4).$5}exo;
if (defined $time) {
$output .= ' ('.strftime('%a, %d %b %Y %T GMT',gmtime($time)).') ';
}
@@ -406,8 +416,8 @@ sub handle_record{
$output = qq(\n";
}
elsif (/recips/) {
- my ($msg_id) = $record->{text} =~ /^Message-Id:\s+<(.+)>/im;
- if (defined $msg_id and exists $$seen_msg_ids{$msg_id}) {
+ my ($msg_id) = record_regex($record,qr/^Message-Id:\s+<(.+)>/i);
+ if (defined $msg_id and exists $$seen_msg_ids{$msg_id}) {
return ();
}
elsif (defined $msg_id) {
@@ -415,7 +425,7 @@ sub handle_record{
}
$output .= qq(
\n);
$output .= 'View this message in rfc822 format
';
- $output .= handle_email_message($record->{text},
+ $output .= handle_email_message($record,
ref => $bug_number,
msg_num => $msg_number,
%param,
@@ -425,7 +435,7 @@ sub handle_record{
# Do nothing
}
elsif (/incoming-recv/) {
- my ($msg_id) = $record->{text} =~ /^Message-Id:\s+<(.+)>/im;
+ my ($msg_id) = record_regex($record,qr/^Message-Id:\s+<(.+)>/i);
if (defined $msg_id and exists $$seen_msg_ids{$msg_id}) {
return ();
}
@@ -433,7 +443,7 @@ sub handle_record{
$$seen_msg_ids{$msg_id} = 1;
}
# Incomming Mail Message
- my ($received,$hostname) = $record->{text} =~ m/Received: \(at (\S+)\) by (\S+)\;/;
+ my ($received,$hostname) = record_regex($record,qr/Received: \(at (\S+)\) by (\S+)\;/o);
$output .= qq|
Message #$msg_number received at |.
html_escape("$received\@$hostname") .
q| (full text'.
@@ -444,11 +454,16 @@ sub handle_record{
)
) .'">mbox, ';
my $parser = MIME::Parser->new();
- # Because we are using memory, not tempfiles, there's no need to
- # clean up here like in Debbugs::MIME
- $parser->tmp_to_core(1);
- $parser->output_to_core(1);
- my $entity = $parser->parse_data($record->{text});
+
+ # this will be cleaned up once it goes out of scope
+ my $tempdir = File::Temp->newdir();
+ $parser->output_under($tempdir->dirname());
+ my $entity;
+ if ($record->{inner_file}) {
+ $entity = $parser->parse($record->{fh});
+ } else {
+ $entity = $parser->parse_data($record->{text});
+ }
my $r_l = reply_headers($entity);
$output .= q(