]> Sergey Matveev's repositories - public-inbox.git/blob - lib/PublicInbox/Spamcheck.pm
watchmaildir: match List-ID case-insensitively
[public-inbox.git] / lib / PublicInbox / Spamcheck.pm
1 # Copyright (C) 2018-2020 all contributors <meta@public-inbox.org>
2 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
3
4 # Spamchecking used by -watch and -mda tools
5 package PublicInbox::Spamcheck;
6 use strict;
7 use warnings;
8
9 sub get {
10         my ($config, $key, $default) = @_;
11         my $spamcheck = $config->{$key};
12         $spamcheck = $default unless $spamcheck;
13
14         return if !$spamcheck || $spamcheck eq 'none';
15
16         if ($spamcheck eq 'spamc') {
17                 $spamcheck = 'PublicInbox::Spamcheck::Spamc';
18         }
19         if ($spamcheck =~ /::/) {
20                 eval "require $spamcheck";
21                 return $spamcheck->new;
22         }
23         warn "unsupported $key=$spamcheck\n";
24         undef;
25 }
26
27 1;