-
- my $buf = $header_obj->as_string;
- unless ($buf =~ /\AFrom /) {
- $fh->write("From mboxrd\@z Thu Jan 1 00:00:00 1970\n");
+ my $ibx = $ctx->{-inbox};
+ my $base = $ibx->base_url($ctx->{cgi});
+ my $mid = mid_clean($header_obj->header('Message-ID'));
+ $mid = uri_escape_utf8($mid);
+ my @append = (
+ 'Archived-At', "<$base$mid/>",
+ 'List-Archive', "<$base>",
+ 'List-Post', "<mailto:$ibx->{-primary_address}>",
+ );
+ my $crlf = $simple->crlf;
+ my $buf = "From mboxrd\@z Thu Jan 1 00:00:00 1970\n" .
+ $header_obj->as_string;
+ for (my $i = 0; $i < @append; $i += 2) {
+ my $k = $append[$i];
+ my $v = $append[$i + 1];
+ my @v = $header_obj->header($k);
+ foreach (@v) {
+ if ($v eq $_) {
+ $v = undef;
+ last;
+ }
+ }
+ $buf .= "$k: $v$crlf" if defined $v;