Help Expanding MultipleQueueDir function

Julian Field MailScanner at ecs.soton.ac.uk
Tue Jun 13 15:14:11 IST 2006


On 13 Jun 2006, at 12:40, Errol Neal wrote:

> I'm trying to expand the MultipleQueueDir function to make it a bit  
> more
> usable for my environment. I'm almost there, but it seems like  
> something
> in the code I've written isn't correct. Now mind you, I'm not a
> Programmer so some of it may be terribly wrong. I reused a lot of  
> what's
> already in CustomConfig.pm.
>
> 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);
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->{$listfile}{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, $PriorityDomainList) = @_;
You set $PriorityDomainList elsewhere at the top of your code, so
my($message) = @_;

>   #return 0 unless $message; # Sanity check the input
return '/var/spool/mqueue' unless $message;

>
>   my(@todomain, $todomain, $isspam);
>   @todomain   = @{$message->{todomain}};
>   $todomain   = $todomain[0];
>   $isspam     = $message->{isspam};
>
>   return '/var/spool/mqueue' unless $message;
If $message was undefined (or 0) then it would have bombed out by  
now, hence my uncommented line in my previous statement.
#return '/var/spool/mqueue' unless $message;

>   return '/var/spool/mqueue.priority' if
> $PriorityDomainList->{$todomain};
$PriorityDomainList{$todomain};

>   return '/var/spool/mqueue.spam' if $message->{$isspam};
return '/var/spool/mqueue.spam' if $isspam;

>   # It is not in the list
>   return '/var/spool/mqueue';
> }
>
> Hopefully, you can get the picture of what I'm trying to do.  
> Domains are
> stored in the prioritylist.conf.
>> From what I can tell, it's not getting beyond opening the file and
> reading it.
> Can someone help me get this working right?
>
> TIA.
>
>
> Errol Neal
> --
> MailScanner mailing list
> mailscanner at lists.mailscanner.info
> http://lists.mailscanner.info/mailman/listinfo/mailscanner
>
> Before posting, read http://wiki.mailscanner.info/posting
>
> Support MailScanner development - buy the book off the website!

-- 
Julian Field
www.MailScanner.info
Buy the MailScanner book at www.MailScanner.info/store
PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.



More information about the MailScanner mailing list