1 # Copyright (C) 2021 all contributors <meta@public-inbox.org>
2 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
4 # implements the "lei rm" command, you can point this at
5 # an entire spam mailbox or read a message from stdin
6 package PublicInbox::LeiRm;
9 use parent qw(PublicInbox::IPC PublicInbox::LeiInput);
11 sub input_eml_cb { # used by PublicInbox::LeiInput::input_fh
12 my ($self, $eml) = @_;
13 $self->{lei}->{sto}->wq_do('remove_eml', $eml);
17 my ($lei, @inputs) = @_;
18 $lei->_lei_store(1)->write_prepare($lei);
19 $lei->{opt}->{'in-format'} //= 'eml' if $lei->{opt}->{stdin};
20 my $self = bless {}, __PACKAGE__;
21 $self->prepare_inputs($lei, \@inputs) or return;
22 $lei->{-err_type} = 'non-fatal';
23 $lei->wq1_start($self);
27 *ipc_atfork_child = \&PublicInbox::LeiInput::input_only_atfork_child;
28 *net_merge_all_done = \&PublicInbox::LeiInput::input_only_net_merge_all_done;