]> Sergey Matveev's repositories - public-inbox.git/blob - lib/PublicInbox/LeiForgetMailSync.pm
lei_mail_sync: rely on flock(2), avoid IPC
[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         $lms->lms_write_prepare;
19         my $err = $lms->arg2folder($lei, \@folders);
20         $lei->qerr(@{$err->{qerr}}) if $err->{qerr};
21         return $lei->fail($err->{fail}) if $err->{fail};
22         $lms->forget_folders(@folders);
23 }
24
25 *_complete_forget_mail_sync = \&PublicInbox::LeiExportKw::_complete_export_kw;
26
27 1;