]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/WatchMaildir.pm
watchmaildir: deal with rejected (100) messages
[public-inbox.git] / lib / PublicInbox / WatchMaildir.pm
index 985f9192078f3497de62e6da5691f706579ef90a..c15e138436cd8964e061a40f725212ef425103af 100644 (file)
@@ -108,10 +108,14 @@ sub _remove_spam {
                        $im->remove($mime);
                        if (my $scrub = _scrubber_for($ibx)) {
                                my $scrubbed = $scrub->scrub($mime) or return;
+                               $scrubbed == 100 and return;
                                $im->remove($scrubbed);
                        }
                };
-               warn "error removing spam at $path from $ibx->{name}\n" if $@;
+               if ($@) {
+                       warn "error removing spam at: ", $path,
+                               " from ", $ibx->{name}, ': ', $@, "\n";
+               }
        })
 }
 
@@ -166,7 +170,9 @@ sub _try_path {
                return unless ($v && $v =~ $wm->[1]);
        }
        if (my $scrub = _scrubber_for($inbox)) {
-               $mime = $scrub->scrub($mime) or return;
+               my $ret = $scrub->scrub($mime) or return;
+               $ret == 100 and return;
+               $mime = $ret;
        }
 
        _force_mid($mime);
@@ -239,7 +245,7 @@ sub _scrubber_for {
        my ($inbox) = @_;
        my $f = $inbox->{filter};
        if ($f && $f =~ /::/) {
-               my @args;
+               my @args = (-inbox => $inbox);
                # basic line splitting, only
                # Perhaps we can have proper quote splitting one day...
                ($f, @args) = split(/\s+/, $f) if $f =~ /\s+/;