We can simplify WwwAtomStream callbacks by performing ->smsg_eml
calls in the `feed_entry' sub itself. This simplifies callers,
by reducing the number of places which can load an Eml object
into memory.
sub generate_i {
my ($ctx) = @_;
while (my $smsg = shift @{$ctx->{msgs}}) {
sub generate_i {
my ($ctx) = @_;
while (my $smsg = shift @{$ctx->{msgs}}) {
- $ctx->{-inbox}->smsg_mime($smsg) and return $smsg;
my $smsg = eval {
PublicInbox::Smsg::from_mitem($mi, $ctx->{srch});
} or next;
my $smsg = eval {
PublicInbox::Smsg::from_mitem($mi, $ctx->{srch});
} or next;
- $ctx->{-inbox}->smsg_mime($smsg) and return $smsg;
use POSIX qw(strftime);
use Digest::SHA qw(sha1_hex);
use PublicInbox::Address;
use POSIX qw(strftime);
use Digest::SHA qw(sha1_hex);
use PublicInbox::Address;
+use PublicInbox::MID qw(mids);
use PublicInbox::Hval qw(ascii_html mid_href);
use PublicInbox::MsgTime qw(msg_timestamp);
use PublicInbox::Hval qw(ascii_html mid_href);
use PublicInbox::MsgTime qw(msg_timestamp);
sub feed_entry {
my ($self, $smsg) = @_;
my $ctx = $self->{ctx};
sub feed_entry {
my ($self, $smsg) = @_;
my $ctx = $self->{ctx};
- my $mid = $smsg->mid; # may extract Message-ID from {mime}
- my $mime = delete $smsg->{mime};
- my $hdr = $mime->header_obj;
+ my $eml = $ctx->{-inbox}->smsg_eml($smsg) or return '';
+ my $hdr = $eml->header_obj;
+ my $mid = $smsg->{mid} // mids($hdr)->[0];
my $irt = PublicInbox::View::in_reply_to($hdr);
my $uuid = to_uuid($mid);
my $base = $ctx->{feed_base_url};
my $irt = PublicInbox::View::in_reply_to($hdr);
my $uuid = to_uuid($mid);
my $base = $ctx->{feed_base_url};
qq(<pre\nstyle="white-space:pre-wrap">);
$ctx->{obuf} = \$s;
$ctx->{mhref} = $href;
qq(<pre\nstyle="white-space:pre-wrap">);
$ctx->{obuf} = \$s;
$ctx->{mhref} = $href;
- PublicInbox::View::multipart_text_as_html($mime, $ctx);
+ PublicInbox::View::multipart_text_as_html($eml, $ctx);
delete $ctx->{obuf};
$s .= '</pre></div></content></entry>';
}
delete $ctx->{obuf};
$s .= '</pre></div></content></entry>';
}