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>
4 # Spamchecking used by -watch and -mda tools
5 package PublicInbox::Spamcheck;
10 my ($cfg, $key, $default) = @_;
11 my $spamcheck = $cfg->{$key};
12 $spamcheck = $default unless $spamcheck;
14 return if !$spamcheck || $spamcheck eq 'none';
16 if ($spamcheck eq 'spamc') {
17 $spamcheck = 'PublicInbox::Spamcheck::Spamc';
19 if ($spamcheck =~ /::/) {
20 eval "require $spamcheck";
21 return $spamcheck->new;
23 warn "unsupported $key=$spamcheck\n";