use Debbugs::Control::Service qw(valid_control control_line);
use Debbugs::Recipients qw(determine_recipients);
use Encode qw(encode_utf8 decode);
+use List::AllUtils qw(first uniqnum);
=head1 NAME
my $logfh = IO::File->new(">>$log_location") or
die "Unable to open $log_location for appending: $!";
write_log_records(logfh => $logfh,
- records => [{type => 'incoming-recv',
- text => $msg,
- }]);
+ records => [Debbugs::Log::Record->
+ new(type => 'incoming-recv',
+ text => $msg,
+ )
+ ]);
close ($logfh) or die "Unable to close $log_location: $!";
}
# RFC1522 encode the header.
$msg = encode_headers($msg) unless $no_encode;
+ my $log = Debbugs::Log->new($ref);
+ $log->write(text=>stripbccs($msg),
+ type => 'recips',
+ recipients => [map {encode_utf8($_)} @{$recips}]
+ );
my $hash = get_hashname($ref);
#save email to the log
my $logfh = IO::File->new(">>db-h/${hash}/${ref}.log") or
die "opening db-h/$hash/${ref}.log: $!";
write_log_records(logfh => $logfh,
- records => {text => stripbccs($msg),
- type => 'recips',
- recips => [map {encode_utf8($_)} @{$recips}],
- },
+ records => [Debbugs::Log::Record->
+ new(text => stripbccs($msg),
+ type => 'recips',
+ recipients => [map {encode_utf8($_)} @{$recips}],
+ )],
);
if (ref($bcc)) {
shift @$recips if $recips->[0] eq '-t';
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]: ".
- $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',
);
}