diff options
author | Eric Wong <e@yhbt.net> | 2020-06-27 10:03:32 +0000 |
---|---|---|
committer | Eric Wong <e@yhbt.net> | 2020-06-28 22:27:11 +0000 |
commit | f115168f63c05832d69756723fe9197b03303048 (patch) | |
tree | c9356ec072da9ef1f9b96bdf87f1c556ffa4add7 /lib | |
parent | e06c008ec1d456d97eb8c52fab8e9a8f924bbdd7 (diff) | |
download | public-inbox-f115168f63c05832d69756723fe9197b03303048.tar.gz |
The old check was ineffective since we process the spam folder config before ham inboxes; and would only fail when attempting to treat the scalar "watchspam" string as an array ref.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/PublicInbox/WatchMaildir.pm | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/lib/PublicInbox/WatchMaildir.pm b/lib/PublicInbox/WatchMaildir.pm index 496199c9..c1f3c5c2 100644 --- a/lib/PublicInbox/WatchMaildir.pm +++ b/lib/PublicInbox/WatchMaildir.pm @@ -52,15 +52,6 @@ sub new { if (is_maildir($dir)) { # skip "new", no MUA has seen it, yet. my $cur = "$dir/cur"; - my $old = $mdmap{$cur}; - if (ref($old)) { - foreach my $ibx (@$old) { - warn <<""; -"$cur already watched for `$ibx->{name}' - - } - die; - } push @mdir, $cur; $uniq{$cur}++; $mdmap{$cur} = 'watchspam'; @@ -84,9 +75,15 @@ sub new { compile_watchheaders($ibx); my $new = "$watch/new"; my $cur = "$watch/cur"; + my $ws = $mdmap{$cur}; + if ($ws && !ref($ws) && $ws eq 'watchspam') { + warn <<EOF; +E: $cur is a spam folder and cannot be used for `$ibx->{name}' input +EOF + return; # onto next inbox + } push @mdir, $new unless $uniq{$new}++; push @mdir, $cur unless $uniq{$cur}++; - push @{$mdmap{$new} ||= []}, $ibx; push @{$mdmap{$cur} ||= []}, $ibx; } else { |