about summary refs log tree commit homepage
path: root/lib/PublicInbox/DirIdle.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/PublicInbox/DirIdle.pm')
-rw-r--r--lib/PublicInbox/DirIdle.pm17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/PublicInbox/DirIdle.pm b/lib/PublicInbox/DirIdle.pm
index 5142d005..7031e5fd 100644
--- a/lib/PublicInbox/DirIdle.pm
+++ b/lib/PublicInbox/DirIdle.pm
@@ -53,6 +53,23 @@ sub new {
         $self;
 }
 
+sub add_watches {
+        my ($self, $dirs, $gone) = @_;
+        my $fl = $MAIL_IN | ($gone ? $MAIL_GONE : 0);
+        for my $d (@$dirs) {
+                $self->{inot}->watch($d, $fl);
+        }
+        PublicInbox::FakeInotify::poll_once($self) if !$ino_cls;
+}
+
+sub rm_watches {
+        my ($self, $dir) = @_;
+        my $inot = $self->{inot};
+        if (my $cb = $inot->can('rm_watches')) { # TODO for fake watchers
+                $cb->($inot, $dir);
+        }
+}
+
 sub event_step {
         my ($self) = @_;
         my $cb = $self->{cb};