use Digest::SHA qw(sha1_hex);
use PublicInbox::Address;
use PublicInbox::Hval qw(ascii_html);
-use PublicInbox::MID qw/mid_clean mid_escape/;
+use PublicInbox::MID qw(mid_escape);
use PublicInbox::MsgTime qw(msg_timestamp);
# called by PSGI server after getline:
my ($class, $ctx, $cb) = @_;
$ctx->{emit_header} = 1;
$ctx->{feed_base_url} = $ctx->{-inbox}->base_url($ctx->{env});
- bless { cb => $cb || *close, ctx => $ctx }, $class;
+ bless { cb => $cb || \&close, ctx => $ctx }, $class;
}
sub response {
sub getline {
my ($self) = @_;
if (my $middle = $self->{cb}) {
- my $smsg = $middle->();
+ my $smsg = $middle->($self->{ctx});
return feed_entry($self, $smsg) if $smsg;
}
delete $self->{cb} ? '</feed>' : undef;
sub feed_entry {
my ($self, $smsg) = @_;
my $ctx = $self->{ctx};
- my $mime = $smsg->{mime};
+ my $mid = $smsg->mid; # may extract Message-ID from {mime}
+ my $mime = delete $smsg->{mime};
my $hdr = $mime->header_obj;
- my $mid = $smsg->mid;
my $irt = PublicInbox::View::in_reply_to($hdr);
my $uuid = to_uuid($mid);
my $base = $ctx->{feed_base_url};