diff options
author | Eric Wong (Contractor, The Linux Foundation) <e@80x24.org> | 2018-03-23 20:29:24 +0000 |
---|---|---|
committer | Eric Wong (Contractor, The Linux Foundation) <e@80x24.org> | 2018-03-27 02:34:20 +0000 |
commit | 007cb8774e7013e2aaca32003bbd1653e3d8582f (patch) | |
tree | 24645e152f6c386730dfdc9925b5dd5ca7740752 /lib/PublicInbox/Mbox.pm | |
parent | 26895bbd94dc93b76274652f9ea35626fd63a5fa (diff) | |
download | public-inbox-007cb8774e7013e2aaca32003bbd1653e3d8582f.tar.gz |
This needs tests and further refinement, but current tests pass.
Diffstat (limited to 'lib/PublicInbox/Mbox.pm')
-rw-r--r-- | lib/PublicInbox/Mbox.pm | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/lib/PublicInbox/Mbox.pm b/lib/PublicInbox/Mbox.pm index 79e09a70..c14037f4 100644 --- a/lib/PublicInbox/Mbox.pm +++ b/lib/PublicInbox/Mbox.pm @@ -26,13 +26,6 @@ sub subject_fn ($) { $fn eq '' ? 'no-subject' : $fn; } -sub smsg_for ($$$) { - my ($head, $db, $mid) = @_; - my $doc_id = $head->get_docid; - my $doc = $db->get_document($doc_id); - PublicInbox::SearchMsg->wrap($doc, $mid)->load_expand; -} - sub mb_stream { my ($more) = @_; bless $more, 'PublicInbox::Mbox'; @@ -47,7 +40,7 @@ sub getline { return msg_str($ctx, $cur); } for (; !defined($cur) && $head != $tail; $head++) { - my $smsg = smsg_for($head, $db, $ctx->{mid}); + my $smsg = PublicInbox::SearchMsg->get($head, $db, $ctx->{mid}); next if $smsg->type ne 'mail'; my $mref = $ctx->{-inbox}->msg_by_smsg($smsg) or next; $cur = Email::Simple->new($mref); @@ -71,7 +64,8 @@ sub emit_raw { $srch->retry_reopen(sub { ($head, $tail, $db) = $srch->each_smsg_by_mid($mid); for (; !defined($first) && $head != $tail; $head++) { - my $smsg = smsg_for($head, $db, $mid); + my @args = ($head, $db, $mid); + my $smsg = PublicInbox::SearchMsg->get(@args); next if $smsg->type ne 'mail'; my $mref = $ibx->msg_by_smsg($smsg) or next; $first = Email::Simple->new($mref); |