CustomFunctions Patch Proposal
davi at jvsinfo.com.br
davi at jvsinfo.com.br
Fri Jun 8 20:36:28 IST 2007
Hello list,
I am developing a tool to configure polices for email with MailScanner.
This police are store in SQL or XML. I consider that an alteration in the
official code of the MailScanner is made to support the sending of
parameter $name of the configuration directive to the custom function.
Thus function would be possible inside of custom to know which parameter
is being searched and return the corresponding value. In such a way, is
not necessary to create a custom function for each directive to use the
XML police. What you think about ?
The Config.pm modification (in black)
sub Value {
my($name, $msg) = @_;
my($funcname, $result);
[...]
# Make this as fast as possible in simple situations
return $StaticScalars{$name} if exists $StaticScalars{$name};
# User custom-written functions are easy to spot too
$funcname = $CustomFunctions{$name};
if ($funcname) {
$funcname = 'MailScanner::CustomConfig::' . $funcname;
no strict 'refs';
# Make patch HERE ! !
$result = &$funcname($msg,$name);
use strict 'refs';
#print STDERR "It was a CF\n" if $name eq 'spamwhitelist';
return $result;
}
The CustonFunction with parameter;
sub MailPolice {
# New here ! !
my ($message,$name) = @_;
MailScanner::Log::InfoLog("MailPolice: DUMPER message " .Dumper($
message));
MailScanner::Log::InfoLog("MailPolice: DUMPER name " .Dumper($name
));
return XmlPoliceGetDirective($name);
}
so a find <maxmessagesize>100</maxmessagesize> and return proper value 100
to MailScanner and in MailScanner.conf i made this:
Max Message Size = &MailPolice
What you think about ?
Sr. Julian Field, this patch in Config.pm are possible?
best regards,
Davi Baldin
JVS do Brasil - IBM BP Premier
davi at jvsinfo.com.br
(19) 3254-1266
(19) 9266-6793 ** NOVO **
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.mailscanner.info/pipermail/mailscanner/attachments/20070608/3c111b45/attachment.html
More information about the MailScanner
mailing list