+sub ext_msg_ALL ($) {
+ my ($ctx) = @_;
+ my $ALL = $ctx->{www}->{pi_cfg}->ALL or return;
+ my $by_eidx_key = $ctx->{www}->{pi_cfg}->{-by_eidx_key};
+ my $cur_key = eval { $ctx->{ibx}->eidx_key } //
+ return partial_response($ctx); # $cur->{ibx} == $ALL
+ my %seen = ($cur_key => 1);
+ my ($id, $prev);
+ while (my $x = $ALL->over->next_by_mid($ctx->{mid}, \$id, \$prev)) {
+ my $xr3 = $ALL->over->get_xref3($x->{num});
+ for my $k (@$xr3) {
+ $k =~ s/:[0-9]+:$x->{blob}\z// or next;
+ next if $k eq $cur_key;
+ my $ibx = $by_eidx_key->{$k} // next;
+ $ibx->base_url or next;
+ push(@{$ctx->{found}}, $ibx) unless $seen{$k}++;
+ }
+ }
+ return exact($ctx) if $ctx->{found};
+
+ # fall back to partial MID matching
+ for my $ibxish ($ctx->{ibx}, $ALL) {
+ my $mids = search_partial($ibxish, $ctx->{mid}) or next;
+ push @{$ctx->{partial}}, [ $ibxish, $mids ];
+ last if ($ctx->{n_partial} += scalar(@$mids)) >= PARTIAL_MAX;
+ }
+ partial_response($ctx);
+}
+