]> Sergey Matveev's repositories - public-inbox.git/commitdiff
watchmaildir: show the current path on spamcheck failures
authorEric Wong <e@80x24.org>
Wed, 26 Jun 2019 09:00:43 +0000 (09:00 +0000)
committerEric Wong <e@80x24.org>
Thu, 27 Jun 2019 22:52:19 +0000 (22:52 +0000)
Knowing which message failed a spam check is tough when I have
many Maildirs and don't have a search indexing tool setup for
spam mail.

lib/PublicInbox/WatchMaildir.pm

index 2d4c6f4340af5d34b01148be0878743be52fc5eb..a76bf06e629db1c5b5381ee04e038fd48b970790 100644 (file)
@@ -150,6 +150,12 @@ sub _try_path {
        if (!ref($inboxes) && $inboxes eq 'watchspam') {
                return _remove_spam($self, $path);
        }
+
+       my $warn_cb = $SIG{__WARN__} || sub { print STDERR @_ };
+       local $SIG{__WARN__} = sub {
+               $warn_cb->("path: $path\n");
+               $warn_cb->(@_);
+       };
        foreach my $ibx (@$inboxes) {
                my $mime = _path_to_mime($path) or next;
                my $im = _importer_for($self, $ibx);