diff options
author | Eric Wong <e@80x24.org> | 2018-07-29 10:05:13 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2018-07-29 10:20:36 +0000 |
commit | 466df3e029fecdabac373d73989c7fceebe6ae28 (patch) | |
tree | ebd6e15fd155202ef251d14dedb39828dc983ca6 /lib/PublicInbox/WatchMaildir.pm | |
parent | 9015a8af2909b0071e54b332bfafc4e5b8d0f6c2 (diff) | |
download | public-inbox-466df3e029fecdabac373d73989c7fceebe6ae28.tar.gz |
This reuses some of the configuration from -watch, but remains independent since some configurations will use -watch for some inboxes and -mda for others. The default remains "spamc" for -mda users so nothing changes without explicit configuration. Per-inbox configurations may also be supported in the future.
Diffstat (limited to 'lib/PublicInbox/WatchMaildir.pm')
-rw-r--r-- | lib/PublicInbox/WatchMaildir.pm | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/lib/PublicInbox/WatchMaildir.pm b/lib/PublicInbox/WatchMaildir.pm index 10dc6184..13dea168 100644 --- a/lib/PublicInbox/WatchMaildir.pm +++ b/lib/PublicInbox/WatchMaildir.pm @@ -14,6 +14,7 @@ use PublicInbox::Spawn qw(spawn); use PublicInbox::InboxWritable; use File::Temp qw//; use PublicInbox::Filter::Base; +use PublicInbox::Spamcheck; *REJECT = *PublicInbox::Filter::Base::REJECT; sub new { @@ -40,19 +41,9 @@ sub new { } my $k = 'publicinboxwatch.spamcheck'; - my $spamcheck = $config->{$k}; - if ($spamcheck) { - if ($spamcheck eq 'spamc') { - $spamcheck = 'PublicInbox::Spamcheck::Spamc'; - } - if ($spamcheck =~ /::/) { - eval "require $spamcheck"; - $spamcheck = _spamcheck_cb($spamcheck->new); - } else { - warn "unsupported $k=$spamcheck\n"; - $spamcheck = undef; - } - } + my $default = undef; + my $spamcheck = PublicInbox::Spamcheck::get($config, $k, $default); + $spamcheck = _spamcheck_cb($spamcheck) if $spamcheck; # need to make all inboxes writable for spam removal: $config->each_inbox(sub { PublicInbox::InboxWritable->new($_[0]) }); |