X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FWatchMaildir.pm;h=bea2ed2aac47b82b91a42c23cdd5b2ef2b05d893;hb=0f6b0cac5bf10d036a84dbab732e8991edf56c34;hp=dfb987e85dd5718648223206e13434b36ff5ca61;hpb=9f5a583694396f84056b9d92255bba0197b52bc8;p=public-inbox.git
diff --git a/lib/PublicInbox/WatchMaildir.pm b/lib/PublicInbox/WatchMaildir.pm
index dfb987e8..bea2ed2a 100644
--- a/lib/PublicInbox/WatchMaildir.pm
+++ b/lib/PublicInbox/WatchMaildir.pm
@@ -1,4 +1,4 @@
-# Copyright (C) 2016-2019 all contributors
+# Copyright (C) 2016-2020 all contributors
# License: AGPL-3.0+
#
# ref: https://cr.yp.to/proto/maildir.html
@@ -11,7 +11,7 @@ use PublicInbox::InboxWritable;
use File::Temp 0.19 (); # 0.19 for ->newdir
use PublicInbox::Filter::Base qw(REJECT);
use PublicInbox::Spamcheck;
-*maildir_path_load = *PublicInbox::InboxWritable::maildir_path_load;
+*mime_from_path = \&PublicInbox::InboxWritable::mime_from_path;
sub new {
my ($class, $config) = @_;
@@ -123,7 +123,7 @@ sub _remove_spam {
my ($self, $path) = @_;
# path must be marked as (S)een
$path =~ /:2,[A-R]*S[T-Za-z]*\z/ or return;
- my $mime = maildir_path_load($path) or return;
+ my $mime = mime_from_path($path) or return;
$self->{config}->each_inbox(sub {
my ($ibx) = @_;
eval {
@@ -165,7 +165,7 @@ sub _try_path {
$warn_cb->(@_);
};
foreach my $ibx (@$inboxes) {
- my $mime = maildir_path_load($path) or next;
+ my $mime = mime_from_path($path) or next;
my $im = _importer_for($self, $ibx);
# any header match means it's eligible for the inbox:
@@ -202,7 +202,8 @@ sub watch {
# lazy load here, we may support watching via IMAP IDLE
# in the future...
- require Filesys::Notify::Simple;
+ eval { require Filesys::Notify::Simple } or
+ die "Filesys::Notify::Simple is currently required for $0\n";
my $fsn = Filesys::Notify::Simple->new([@{$self->{mdir}}, $scandir]);
$fsn->wait($cb) until $self->{quit};
}