From aae8eb6de7b8ed4b1370971e91802b12da7f81aa Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 1 Jun 2020 10:06:46 +0000 Subject: wwwatomstream: convert callers to use smsg_eml 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. --- lib/PublicInbox/WwwAtomStream.pm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lib/PublicInbox/WwwAtomStream.pm') diff --git a/lib/PublicInbox/WwwAtomStream.pm b/lib/PublicInbox/WwwAtomStream.pm index c3fbb1a7..6ed0cb21 100644 --- a/lib/PublicInbox/WwwAtomStream.pm +++ b/lib/PublicInbox/WwwAtomStream.pm @@ -12,6 +12,7 @@ use warnings; 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); @@ -99,9 +100,9 @@ sub atom_header { 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}; @@ -141,7 +142,7 @@ sub feed_entry { qq(); $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 .= ''; } -- cgit v1.2.3-24-ge0c7