]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/WatchMaildir.pm
note the source code is AGPL for cloning
[public-inbox.git] / lib / PublicInbox / WatchMaildir.pm
index 145b363689ee7aa42c292f99c15798a404b7ff24..c8ea3ed3d2613e18f796f23126a0a2709c97a7dc 100644 (file)
@@ -18,21 +18,25 @@ sub new {
        my ($class, $config) = @_;
        my (%mdmap, @mdir, $spamc);
 
-       # XXX is "publicinboxlearn" really a good namespace for this?
-       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';
-               } else {
-                       warn "unsupported $k=$spamdir\n";
+       # "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 $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';
+                       } else {
+                               warn "unsupported $k=$spamdir\n";
+                       }
                }
        }
 
-       $k = 'publicinboxwatch.spamcheck';
+       my $k = 'publicinboxwatch.spamcheck';
        my $spamcheck = $config->{$k};
        if ($spamcheck) {
                if ($spamcheck eq 'spamc') {
@@ -214,7 +218,7 @@ sub _importer_for {
                my $git = $inbox->git;
                my $name = $inbox->{name};
                my $addr = $inbox->{-primary_address};
-               PublicInbox::Import->new($git, $name, $addr);
+               PublicInbox::Import->new($git, $name, $addr, $inbox);
        };
        $self->{importers}->{"$im"} = $im;
 }