]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/DirIdle.pm
lei: start implementing inotify Maildir support
[public-inbox.git] / lib / PublicInbox / DirIdle.pm
index 5142d005e4aa326543fe8a99dca0c4e491eb42c5..7031e5fd5615f17aa1df4467c6aebdcf36d7c31a 100644 (file)
@@ -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};