about summary refs log tree commit homepage
path: root/lib/PublicInbox/LeiForgetMailSync.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/PublicInbox/LeiForgetMailSync.pm')
-rw-r--r--lib/PublicInbox/LeiForgetMailSync.pm26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/PublicInbox/LeiForgetMailSync.pm b/lib/PublicInbox/LeiForgetMailSync.pm
new file mode 100644
index 00000000..762910ed
--- /dev/null
+++ b/lib/PublicInbox/LeiForgetMailSync.pm
@@ -0,0 +1,26 @@
+# Copyright (C) 2021 all contributors <meta@public-inbox.org>
+# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
+
+# "lei forget-mail-sync" drop synchronization information
+# TODO: figure out what to do about "lei index" users having
+# dangling references.  Perhaps just documenting "lei index"
+# use being incompatible with "forget-mail-sync" use is
+# sufficient.
+
+package PublicInbox::LeiForgetMailSync;
+use strict;
+use v5.10.1;
+use PublicInbox::LeiRefreshMailSync;
+
+sub lei_forget_mail_sync {
+        my ($lei, @folders) = @_;
+        my $lms = $lei->lms or return;
+        $lms->lms_write_prepare;
+        $lms->arg2folder($lei, \@folders); # may die
+        $lms->forget_folders(@folders);
+}
+
+*_complete_forget_mail_sync =
+        \&PublicInbox::LeiRefreshMailSync::_complete_refresh_mail_sync;
+
+1;