Help Expanding MultipleQueueDir function
Errol Neal
eneal at dfi-intl.com
Tue Jun 13 17:34:33 IST 2006
Thanks for your help Julian. This is the final result..
my ($PriorityDomainListFile) =
'/etc/MailScanner/rules/prioritylist.conf';
use FileHandle;
sub InitMultipleQueueDir {
MailScanner::Log::InfoLog("Initialising list for domains receiving
priority service");
#"from %s", $PriorityDomainListFile);
my $listfile = new FileHandle;
unless($listfile->open("<$PriorityDomainListFile")) {
MailScanner::Log::WarnLog("Could not read list of domains for
priority service " .
"from %s", $PriorityDomainListFile);
return;
}
my($fh, $line, %PriorityDomainList);
$line = 0;
while (<$listfile>) {
$line++;
chomp;
#print STDERR "Line is \"$_\"\n";
s/#.*$//; # Strip comments
s/\S*:\S*//g; # Strip any words with ":" in them
s/^\s+//g; # Strip leading whitespace
s/^(\S+)\s.*$/$1/; # Use only the 1st word
s/^\*\@//; # Strip any leading "*@" they might have put in
#print STDERR "Line is \"$_\"\n";
next if /^$/; # Strip blank lines
#$PriorityDomainList->{$PriorityDomainListFile}{lc($_)} = 1; #
Store the domains
$PriorityDomainList{lc($_)} = 1;
return;
}
$fh->close();
MailScanner::Log::InfoLog("Read %d domains from %s", $line,
$PriorityDomainListFile);
}
sub EndMultipleQueueDir {
MailScanner::Log::InfoLog("Shutting down priority domain list");
}
sub MultipleQueueDir {
my($message) = @_;
return '/var/spool/mqueue' unless $message; # Sanity check the input
my(@todomain, $todomain, $isspam);
@todomain = @{$message->{todomain}};
$todomain = $todomain[0];
$isspam = $message->{isspam};
return '/var/spool/mqueue.priority' if $PriorityDomainList{$todomain};
return '/var/spool/mqueue.spam' if $isspam;
# It is not in the list
return '/var/spool/mqueue';
}
I get an error though when starting it up.
Global symbol "%PriorityDomainList" requires explicit package name at
/usr/lib/MailScanner/MailScanner/CustomConfig.pm line 718.
Any thoughts?
More information about the MailScanner
mailing list