X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FMbox.pm;h=4f632d63558935c62b5e0af1ea882c81e39768a0;hb=87678710135973f72722258e171fc00f85c86ec8;hp=3fdda5eaa8100f0435ce8b8f1a4f4612f9fe8204;hpb=07c51ae017dae0ea221ba756e9c6ec46f6a587de;p=public-inbox.git diff --git a/lib/PublicInbox/Mbox.pm b/lib/PublicInbox/Mbox.pm index 3fdda5ea..4f632d63 100644 --- a/lib/PublicInbox/Mbox.pm +++ b/lib/PublicInbox/Mbox.pm @@ -1,4 +1,4 @@ -# Copyright (C) 2015-2019 all contributors +# Copyright (C) 2015-2020 all contributors # License: AGPL-3.0+ # Streaming (via getline) interface for formatting messages as an mboxrd. @@ -12,6 +12,7 @@ use strict; use warnings; use PublicInbox::MID qw/mid_escape/; use PublicInbox::Hval qw/to_filename/; +use PublicInbox::Smsg; use Email::Simple; use Email::MIME::Encode; @@ -23,11 +24,10 @@ sub subject_fn ($) { # no need for full Email::MIME, here if ($fn =~ /=\?/) { eval { $fn = Encode::decode('MIME-Header', $fn) }; - $fn = 'no-subject' if $@; + return 'no-subject' if $@; } $fn =~ s/^re:\s+//i; - $fn = to_filename($fn); - $fn eq '' ? 'no-subject' : $fn; + $fn eq '' ? 'no-subject' : to_filename($fn); } sub mb_stream { @@ -204,10 +204,8 @@ sub results_cb { my $srch = $ctx->{srch}; while (1) { while (my $mi = (($mset->items)[$ctx->{iter}++])) { - my $doc = $mi->get_document; - my $smsg = $srch->retry_reopen(sub { - PublicInbox::SearchMsg->load_doc($doc); - }) or next; + my $smsg = PublicInbox::Smsg::from_mitem($mi, + $srch) or next; return $smsg; } # refill result set