From 5b4fde37adefa37508d131dbe013353ef3345051 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 19 Jul 2021 08:59:35 +0000 Subject: lei: start implementing inotify Maildir support This allows lei to automatically note keyword (message flag) changes made to a Maildir and propagate it into lei/store: lei add-watch --state=tag-ro /path/to/Maildir This doesn't persist across restarts, yet. In the future, it will be applied automatically to "lei q" output Maildirs by default (with an option to disable it). State values of tag-rw, index-, import- will all be supported for Maildir. This represents a fairly major internal change that's fairly intrusive, but the whole daemon-oriented design was to facilitate being able to automatically monitor (and propagate) Maildir/IMAP flag changes. --- lib/PublicInbox/LeiLsWatch.pm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 lib/PublicInbox/LeiLsWatch.pm (limited to 'lib/PublicInbox/LeiLsWatch.pm') diff --git a/lib/PublicInbox/LeiLsWatch.pm b/lib/PublicInbox/LeiLsWatch.pm new file mode 100644 index 00000000..f96dc4ec --- /dev/null +++ b/lib/PublicInbox/LeiLsWatch.pm @@ -0,0 +1,15 @@ +# Copyright all contributors +# License: AGPL-3.0+ + +package PublicInbox::LeiLsWatch; +use strict; +use v5.10.1; + +sub lei_ls_watch { + my ($lei) = @_; + my $cfg = $lei->_lei_cfg or return; + my @w = (join("\n", keys %$cfg) =~ m/^watch\.(.+?)\.state$/sgm); + $lei->puts(join("\n", @w)) if @w; +} + +1; -- cgit v1.2.3-24-ge0c7