]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/WatchMaildir.pm
watch: use "spam" in commit message for removals
[public-inbox.git] / lib / PublicInbox / WatchMaildir.pm
index 8e10e43f056c677d4deb6e116a71692a55eed704..424186bd35f5f36ea5d02cc18cfdc8561ec55551 100644 (file)
@@ -132,11 +132,11 @@ sub _remove_spam {
                my ($ibx) = @_;
                eval {
                        my $im = _importer_for($self, $ibx);
-                       $im->remove($mime);
+                       $im->remove($mime, 'spam');
                        if (my $scrub = _scrubber_for($ibx)) {
                                my $scrubbed = $scrub->scrub($mime) or return;
                                $scrubbed == 100 and return;
-                               $im->remove($scrubbed);
+                               $im->remove($scrubbed, 'spam');
                        }
                };
                if ($@) {
@@ -225,7 +225,7 @@ sub watch {
 
 sub trigger_scan {
        my ($self, $base) = @_;
-       my $dir = $self->{scandir} or die "not watch-ing, yet\n";
+       my $dir = $self->{scandir} or return;
        open my $fh, '>', "$dir/$base" or die "open $dir/$base failed: $!\n";
        close $fh or die "close $dir/$base failed: $!\n";
 }
@@ -235,6 +235,7 @@ sub scan {
        if ($path =~ /quit\z/) {
                %{$self->{opendirs}} = ();
                _done_for_now($self);
+               delete $self->{scandir};
                $self->{quit} = 1;
                return;
        }