don't return absolute paths. We walk the file list enough times
already, there's no need to walk it for this.
(filter_mail): Skip . and .. in the @msglist.
(MAIN): Instead of passing getfiles $MAILDIR/new, chdir there and pass '.'.
# to detect an error. Real Programmers don't handle errors,
# right? >sigh<
$! = 0;
# to detect an error. Real Programmers don't handle errors,
# right? >sigh<
$! = 0;
- @result = grep {
- ($_ ne '.' and $_ ne '..')
- and $_ = "$MAILDIR/new/$_"
- } readdir(DIR);
-
+ @result = readdir(DIR);
if ($! != 0) {
die("readdir($dir): $!");
}
if ($! != 0) {
die("readdir($dir): $!");
}
@baton = spam_start_hook();
foreach $msg (@msglist) {
@baton = spam_start_hook();
foreach $msg (@msglist) {
+ ($msg eq '.' or $msg eq '..') and next;
+
if ($printfilenames) {
print("$msg\n");
}
if ($printfilenames) {
print("$msg\n");
}
+ chdir("$MAILDIR/new") or die("chdir($MAILDIR/new): $!");
filter_mail(map { $_->[1] }
sort { $a->[0] <=> $b->[0] }
map {
filter_mail(map { $_->[1] }
sort { $a->[0] <=> $b->[0] }
map {
- getfiles("$MAILDIR/new"));
@SPAM and (exec('scan', '+SPAM', @SPAM) or die);
}
@SPAM and (exec('scan', '+SPAM', @SPAM) or die);
}