X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FExtMsg.pm;h=c71510f548191b966cfb4835256764f4ceeae7f3;hb=471cc731579002419d23f64509497dd486dd632c;hp=f3076a3476daef7022f66408a8b9cc6f4b1a0352;hpb=cab22861f2a22482b74d20c05afbd6108a4590cb;p=public-inbox.git diff --git a/lib/PublicInbox/ExtMsg.pm b/lib/PublicInbox/ExtMsg.pm index f3076a34..c71510f5 100644 --- a/lib/PublicInbox/ExtMsg.pm +++ b/lib/PublicInbox/ExtMsg.pm @@ -84,17 +84,33 @@ sub ext_msg { my $n_partial = 0; my @partial; - eval { require PublicInbox::Msgmap }; - my $have_mm = $@ ? 0 : 1; - if ($have_mm) { + if (my $mm = $cur->mm) { + my $tmp_mid = $mid; + my $res = $mm->mid_prefixes($tmp_mid, 100); + if ($res && scalar(@$res)) { + $n_partial += scalar(@$res); + push @partial, [ $cur, $res ]; + # fixup common errors: + } elsif ($tmp_mid =~ s,/[tTf],,) { + $res = $mm->mid_prefixes($tmp_mid, 100); + if ($res && scalar(@$res)) { + $n_partial += scalar(@$res); + push @partial, [ $cur, $res ]; + } + } + } + + # can't find a partial match in current inbox, try the others: + if (!$n_partial && length($mid) >= 16) { my $tmp_mid = $mid; again: - unshift @ibx, $cur; foreach my $ibx (@ibx) { my $mm = $ibx->mm or next; - if (my $res = $mm->mid_prefixes($tmp_mid)) { + my $res = $mm->mid_prefixes($tmp_mid, 100); + if ($res && scalar(@$res)) { $n_partial += scalar(@$res); push @partial, [ $ibx, $res ]; + last if $n_partial >= 100; } } # fixup common errors: