diff options
author | Eric Wong <e@80x24.org> | 2016-06-19 02:13:52 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2016-06-19 02:23:50 +0000 |
commit | 763928565699beea87006156c565d0f808f9becc (patch) | |
tree | 70738081cbf15af724d3c38bafa26e67921f19cc /lib/PublicInbox | |
parent | 0c17b6e39fe98a0da0b0deaa4fd014343362a33f (diff) | |
download | public-inbox-763928565699beea87006156c565d0f808f9becc.tar.gz |
Only mark seen messages as spam, otherwise it could be too aggressive and cause problems or over training. We wouldn't want a wayward FIFO ruining our day, either :)
Diffstat (limited to 'lib/PublicInbox')
-rw-r--r-- | lib/PublicInbox/WatchMaildir.pm | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/PublicInbox/WatchMaildir.pm b/lib/PublicInbox/WatchMaildir.pm index cb64f899..4468a448 100644 --- a/lib/PublicInbox/WatchMaildir.pm +++ b/lib/PublicInbox/WatchMaildir.pm @@ -71,6 +71,7 @@ sub _try_fsn_paths { sub _check_spam { my ($self, $path) = @_; + $path =~ /:2,[A-R]*S[T-Z]*\z/ or return; my $mime = _path_to_mime($path) or return; _force_mid($mime); foreach my $inbox (values %{$self->{mdmap}}) { @@ -107,6 +108,9 @@ sub _force_mid { sub _try_path { my ($self, $path) = @_; + my @p = split(m!/+!, $path); + return unless $p[-1] =~ /\A[a-zA-Z0-9][\w:,=\.]+\z/; + return unless -f $path; if ($path !~ $self->{mdre}) { warn "unrecognized path: $path\n"; return; @@ -155,13 +159,7 @@ sub scan { next; } while (my $fn = readdir($dh)) { - next unless $fn =~ /\A[a-zA-Z0-9][\w:,=\.]+\z/; - $fn = "$dir/$fn"; - if (-f $fn) { - _try_path($self, $fn); - } else { - warn "not a file: $fn\n"; - } + _try_path($self, "$dir/$fn"); } closedir $dh; } |