about summary refs log tree commit homepage
path: root/lib/PublicInbox/WatchMaildir.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-09-01 19:31:12 +0000
committerEric Wong <e@80x24.org>2016-09-01 19:31:12 +0000
commite8118c2f2d6acd9aeb08aa797874fa3433b07766 (patch)
tree78b57bfcc65bf4f184c1765c0dc23e2cde4ce001 /lib/PublicInbox/WatchMaildir.pm
parent8f4448f6b8098235d54f48ea7e3b572caa82632d (diff)
downloadpublic-inbox-e8118c2f2d6acd9aeb08aa797874fa3433b07766.tar.gz
We'll keep supporting "publicinboxlearn" indefinitely,
but "publicinboxwatch" is probably more appropriate
at the moment.

Noticed while writing documentation.
Diffstat (limited to 'lib/PublicInbox/WatchMaildir.pm')
-rw-r--r--lib/PublicInbox/WatchMaildir.pm28
1 files changed, 16 insertions, 12 deletions
diff --git a/lib/PublicInbox/WatchMaildir.pm b/lib/PublicInbox/WatchMaildir.pm
index f34419a3..c8ea3ed3 100644
--- a/lib/PublicInbox/WatchMaildir.pm
+++ b/lib/PublicInbox/WatchMaildir.pm
@@ -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') {