my @append = (
'Archived-At', "<$base$mid/>",
'List-Archive', "<$base>",
- 'List-Post', "<mailto:$ibx->{-primary_address}>",
);
my $crlf = $header_obj->crlf;
my $buf = $header_obj->as_string;
my $k = $append[$i];
my $v = $append[$i + 1];
my @v = $header_obj->header_raw($k);
- foreach (@v) {
- if ($v eq $_) {
- $v = undef;
- last;
- }
- }
- $buf .= "$k: $v$crlf" if defined $v;
+ $buf .= "$k: $v$crlf" if !grep(/\A\Q$v\E\z/, @v);
+ }
+ my $post_addr = $ibx->{-primary_address};
+ if ($post_addr && $header_obj->header_raw('List-Post')) {
+ $buf .= "List-Post: <mailto:$post_addr>$crlf";
}
$buf .= $crlf;
}
# *something* here is required for leafnode, try to follow
# RFC 5536 3.1.5...
$hdr->header_set('Path', $server_name . '!not-for-mail');
-
- header_append($hdr, 'List-Post', "<mailto:$ibx->{-primary_address}>");
+ if (my $post_addr = $ibx->{-primary_address}) {
+ header_append($hdr, 'List-Post', "<mailto:$post_addr>");
+ }
if (my $url = $ibx->base_url) {
$mid = mid_escape($mid);
header_append($hdr, 'Archived-At', "<$url$mid/>");
}
$urls .= "\n" . join('', map { "\tgit clone --mirror $_\n" } @urls);
- my $addrs = $ibx->{address};
- $addrs = join(' ', @$addrs) if ref($addrs) eq 'ARRAY';
- my $v = defined $max ? '-V2' : '-V1';
- $urls .= <<EOF;
+ if (my $addrs = $ibx->{address}) {
+ $addrs = join(' ', @$addrs) if ref($addrs) eq 'ARRAY';
+ my $v = defined $max ? '-V2' : '-V1';
+ $urls .= <<EOF;
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
$addrs
public-inbox-index $dir
EOF
+ }
my $cfg_link = ($ctx->{-upfx} // '').'_/text/config/raw';
$urls .= <<EOF;