}
sub ovv_each_smsg_cb { # runs in wq worker usually
- my ($self, $lei, $ibxish) = @_;
+ my ($self, $lei) = @_;
my ($json, $dedupe);
if (my $pkg = $self->{json}) {
$json = $pkg->new;
$dedupe->prepare_dedupe;
}
$lei->{ovv_buf} = \(my $buf = '') if !$l2m;
- if ($l2m && !$ibxish) { # remote https?:// mboxrd
- my $wcb = $l2m->write_cb($lei);
- sub {
- my ($smsg, undef, $eml) = @_; # no mitem in $_[1]
- $wcb->(undef, $smsg, $eml);
- };
- } elsif ($l2m && $l2m->{-wq_s1}) {
+ if ($l2m) {
sub {
- my ($smsg, $mitem) = @_;
+ my ($smsg, $mitem, $eml) = @_;
$smsg->{pct} = get_pct($mitem) if $mitem;
- $l2m->wq_io_do('write_mail', [], $smsg);
+ $l2m->wq_io_do('write_mail', [], $smsg, $eml);
}
} elsif ($self->{fmt} =~ /\A(concat)?json\z/ && $lei->{opt}->{pretty}) {
my $EOR = ($1//'') eq 'concat' ? "\n}" : "\n},";
}
sub write_mail { # via ->wq_io_do
- my ($self, $smsg) = @_;
+ my ($self, $smsg, $eml) = @_;
+ return $self->{wcb}->(undef, $smsg, $eml) if $eml;
$self->{lei}->{ale}->git->cat_async($smsg->{blob}, \&git_to_mail,
[$self->{wcb}, $smsg]);
}
return warn("$desc not indexed by Xapian\n") unless ($srch && $over);
my $mo = { %{$lei->{mset_opt}} };
my $mset;
- my $each_smsg = $lei->{ovv}->ovv_each_smsg_cb($lei, $ibxish);
+ my $each_smsg = $lei->{ovv}->ovv_each_smsg_cb($lei);
my $can_kw = !!$ibxish->can('msg_keywords');
my $fl = $lei->{opt}->{threads} > 1 ? 1 : undef;
do {
for my $loc (locals($self)) {
attach_external($self, $loc);
}
- my $each_smsg = $lei->{ovv}->ovv_each_smsg_cb($lei, $self);
+ my $each_smsg = $lei->{ovv}->ovv_each_smsg_cb($lei);
do {
$mset = $self->mset($mo->{qstr}, $mo);
mset_progress($lei, 'xsearch', $mset->size,