Having a one-off Maildir functionality in LeiStore doesn't seem
worth the maintenance burden, especially given an upcoming
change to skip trashed messages.
I expect this will hurt performance slightly with extra IPC
overhead for the socket copy, but "lei import" may eventually
become rare or at least not hit messages redundantly.
$lei->child_error(1 << 8, "$input: $@") if $@;
}
$lei->child_error(1 << 8, "$input: $@") if $@;
}
-sub _import_maildir { # maildir_each_file cb
- my ($f, $sto, $set_kw) = @_;
- $sto->ipc_do('set_eml_from_maildir', $f, $set_kw);
+sub _import_maildir { # maildir_each_eml cb
+ my ($f, $kw, $eml, $sto, $set_kw) = @_;
+ $sto->ipc_do('set_eml', $eml, $set_kw ? @$kw : ());
}
sub _import_net { # imap_each, nntp_each cb
}
sub _import_net { # imap_each, nntp_each cb
return $lei->fail(<<EOM) if $ifmt && $ifmt ne 'maildir';
$input appears to a be a maildir, not $ifmt
EOM
return $lei->fail(<<EOM) if $ifmt && $ifmt ne 'maildir';
$input appears to a be a maildir, not $ifmt
EOM
- PublicInbox::MdirReader::maildir_each_file($input,
+ PublicInbox::MdirReader::maildir_each_eml($input,
\&_import_maildir,
$lei->{sto}, $lei->{opt}->{kw});
} else {
\&_import_maildir,
$lei->{sto}, $lei->{opt}->{kw});
} else {
add_eml($self, $eml, @kw) // set_eml_keywords($self, $eml, @kw);
}
add_eml($self, $eml, @kw) // set_eml_keywords($self, $eml, @kw);
}
-sub set_eml_from_maildir {
- my ($self, $f, $set_kw) = @_;
- my $eml = eml_from_path($f) or return;
- set_eml($self, $eml, $set_kw ? maildir_keywords($f) : ());
-}
-
sub checkpoint {
my ($self, $wait) = @_;
if (my $im = $self->{im}) {
sub checkpoint {
my ($self, $wait) = @_;
if (my $im = $self->{im}) {