]> Sergey Matveev's repositories - public-inbox.git/commitdiff
watch: allow multiple spam watch directories
authorEric Wong <e@80x24.org>
Mon, 1 Jul 2019 02:18:48 +0000 (02:18 +0000)
committerEric Wong <e@80x24.org>
Sat, 6 Jul 2019 04:30:31 +0000 (04:30 +0000)
Given most folks have multiple mail accounts, there's no reason
we can't support multiple Maildirs.

lib/PublicInbox/WatchMaildir.pm

index 4be0b397217d55334fa6575cbe58b77a6cbdbf51..e49fb6c78d91d71edc59b25462f39974525ed019 100644 (file)
@@ -24,7 +24,9 @@ sub new {
        # indefinitely...
        foreach my $pfx (qw(publicinboxwatch publicinboxlearn)) {
                my $k = "$pfx.watchspam";
-               if (my $dir = $config->{$k}) {
+               defined(my $dirs = $config->{$k}) or next;
+               $dirs = [ $dirs ] if !ref($dirs);
+               for my $dir (@$dirs) {
                        if (is_maildir($dir)) {
                                # skip "new", no MUA has seen it, yet.
                                my $cur = "$dir/cur";