From cd36914a0e6650c87f1deb83ed1ec78f72951a4b Mon Sep 17 00:00:00 2001 From: epg <> Date: Thu, 30 Mar 2006 03:08:12 +0000 Subject: [PATCH 1/1] Handle files in $maildir/spam (from new mdeliver processor). --- minc | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/minc b/minc index eba819f..fbeba15 100755 --- a/minc +++ b/minc @@ -743,6 +743,34 @@ sub update_dot_folders { build_dot_folders($folders, $fh); } +# XXX Could use some unification with getfiles... +sub maildir_spam { + my $dir = "$MAILDIR/spam"; + + if (not chdir($dir)) { + print(STDERR "skipping maildir spam: chdir($dir): $!\n"); + return; + } + + if (not opendir(DIR, '.')) { + print(STDERR "skipping maildir spam: opendir($dir): $!\n"); + return; + } + + $! = 0; + my @spams = readdir(DIR); + if ($! != 0) { + print(STDERR "skipping maildir spam: readdir($dir): $!\n"); + } + + closedir(DIR); + + for my $msg (@spams) { + ($msg eq '.' or $msg eq '..') and next; + store_message($msg, 'SPAM'); + } +} + MAIN: { my $st; @@ -769,6 +797,8 @@ MAIN: { $run and update_dot_folders(\%folders); + maildir_spam(); + @SPAM and (exec('scan', '+SPAM', @SPAM) or die); } -- 2.56.0