]> Sergey Matveev's repositories - public-inbox.git/commitdiff
watch: use "publicinboxwatch" namespace
authorEric Wong <e@80x24.org>
Thu, 1 Sep 2016 19:31:12 +0000 (19:31 +0000)
committerEric Wong <e@80x24.org>
Thu, 1 Sep 2016 19:31:12 +0000 (19:31 +0000)
We'll keep supporting "publicinboxlearn" indefinitely,
but "publicinboxwatch" is probably more appropriate
at the moment.

Noticed while writing documentation.

lib/PublicInbox/WatchMaildir.pm

index f34419a399005b6bbbfb7bbb27cb9a22442519fe..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') {