- my (%mdmap, @mdir);
- my $k = 'publicinboxlearn.watchspam';
- if (my $spamdir = $config->{$k}) {
- if ($spamdir =~ s/\Amaildir://) {
- $spamdir =~ s!/+\z!!;
- # skip "new", no MUA has seen it, yet.
- my $cur = "$spamdir/cur";
- push @mdir, $cur;
- $mdmap{$cur} = 'watchspam';
+ my (%mdmap, @mdir, $spamc, $spamdir);
+
+ # "publicinboxwatch" is the documented namespace
+ # "publicinboxlearn" is legacy but may be supported
+ # indefinitely...
+ foreach my $pfx (qw(publicinboxwatch publicinboxlearn)) {
+ my $k = "$pfx.watchspam";
+ if (my $dir = $config->{$k}) {
+ if ($dir =~ s/\Amaildir://) {
+ $dir =~ s!/+\z!!;
+ # skip "new", no MUA has seen it, yet.
+ my $cur = "$dir/cur";
+ $spamdir = $cur;
+ push @mdir, $cur;
+ $mdmap{$cur} = 'watchspam';
+ } else {
+ warn "unsupported $k=$dir\n";
+ }
+ }
+ }
+
+ 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);