]> Sergey Matveev's repositories - public-inbox.git/blob - lib/PublicInbox/LeiForgetMailSync.pm
get rid of unnecessary bytes::length usage
[public-inbox.git] / lib / PublicInbox / LeiForgetMailSync.pm
1 # Copyright (C) 2021 all contributors <meta@public-inbox.org>
2 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
3
4 # "lei forget-mail-sync" drop synchronization information
5 # TODO: figure out what to do about "lei index" users having
6 # dangling references.  Perhaps just documenting "lei index"
7 # use being incompatible with "forget-mail-sync" use is
8 # sufficient.
9
10 package PublicInbox::LeiForgetMailSync;
11 use strict;
12 use v5.10.1;
13 use PublicInbox::LeiExportKw;
14
15 sub lei_forget_mail_sync {
16         my ($lei, @folders) = @_;
17         my $lms = $lei->lms or return;
18         my $sto = $lei->_lei_store or return; # may disappear due to race
19         $sto->write_prepare($lei);
20         my $err = $lms->arg2folder($lei, \@folders);
21         $lei->qerr(@{$err->{qerr}}) if $err->{qerr};
22         return $lei->fail($err->{fail}) if $err->{fail};
23         $sto->ipc_do('lms_forget_folders', @folders);
24         $lei->sto_done_request;
25 }
26
27 *_complete_forget_mail_sync = \&PublicInbox::LeiExportKw::_complete_export_kw;
28
29 1;