- my ($buf, $oid, $kw) = @_;
- return unless $out;
- my $eml = PublicInbox::Eml->new($buf);
- if (!$dedupe->is_dup($eml, $oid)) {
- $buf = $eml2mbox->($eml, $kw);
- my $lk = $ovv->lock_for_scope;
- eval { $write->($out, $buf) };
- if ($@) {
- die $@ if ref($@) ne 'PublicInbox::SIGPIPE';
- undef $out
- }
- }
- }
-}
-
-sub _maildir_each_file ($$;@) {
- my ($dir, $cb, @arg) = @_;
- for my $d (qw(new/ cur/)) {
- my $pfx = $dir.$d;
- opendir my $dh, $pfx or next;
- while (defined(my $fn = readdir($dh))) {
- $cb->($pfx.$fn, @arg) if $fn =~ /:2,[A-Za-z]*\z/;
- }
+ my ($buf, $smsg, $eml) = @_;
+ $eml //= PublicInbox::Eml->new($buf);
+ return if $dedupe->is_dup($eml, $smsg->{blob});
+ $buf = $eml2mbox->($eml, $smsg);
+ return atomic_append($lei, $buf) if $atomic_append;
+ my $lk = $ovv->lock_for_scope;
+ $lei->out($$buf);