-# Copyright (C) 2015-2018 all contributors <meta@public-inbox.org>
+# Copyright (C) 2015-2019 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
# Streaming (via getline) interface for formatting messages as an mboxrd.
sub close {} # noop
+# /$INBOX/$MESSAGE_ID/raw
sub emit_raw {
my ($ctx) = @_;
my $mid = $ctx->{mid};
my $ibx = $ctx->{-inbox};
+ $ctx->{base_url} = $ibx->base_url($ctx->{env});
my ($mref, $more, $id, $prev, $next);
if (my $over = $ibx->over) {
my $smsg = $over->next_by_mid($mid, \$id, \$prev) or return;
$header_obj->header_set($d);
}
my $ibx = $ctx->{-inbox};
- my $base = $ibx->base_url($ctx->{env});
+ my $base = $ctx->{base_url};
$mid = $ctx->{mid} unless defined $mid;
$mid = mid_escape($mid);
my @append = (
sub msg_body ($) {
# mboxrd quoting style
- # ref: http://www.qmail.org/man/man5/mbox.html
+ # https://en.wikipedia.org/wiki/Mbox#Modified_mbox
+ # https://www.loc.gov/preservation/digital/formats/fdd/fdd000385.shtml
+ # https://web.archive.org/http://www.qmail.org/man/man5/mbox.html
$_[0] =~ s/^(>*From )/>$1/gm;
$_[0] .= "\n";
}
sub new {
my ($class, $ctx, $cb) = @_;
my $buf = '';
+ $ctx->{base_url} = $ctx->{-inbox}->base_url($ctx->{env});
bless {
buf => \$buf,
gz => IO::Compress::Gzip->new(\$buf, Time => 0),