More than one Custom Function

Julian Field MailScanner at ecs.soton.ac.uk
Fri May 15 10:15:14 IST 2009



On 14/05/2009 18:28, Paul wrote:
> Julian Field wrote:
>>>> On 13/05/2009 12:32, Paul Houselander wrote:
>>>>> Hi
>>>>>
>>>>> I have a mailscanner set up that uses the Always Looked Up Last
>>>>> directive to call a custom function I wrote that logs to a postgres
>>>>> database.
>>>>> I want to try to get it to now to ALSO log to a mysql database using
>>>>> mailwatch.
>>>>> Is it possible to run 2 CustomFunctions from the same directive?
>>>>>
>>>> Why not just write a Custom Function that calls both bits of code?
>>>> Just pass all the parameters to both functions, simple as that.
>>>>
>>>> Jules
>>>>
>>> Hi Jules
>>>
>>> I did think about doing that, it was just I recalled someone writing a
>>> wrapper that allowed you to call 2 custom functions? I may well have
>>> drembt it as cant find anything via the wiki or searching through the
>>> archives!
>>
>> I do this with a function called wrapper (not real unique)
>>
>> In MailScanner.conf
>>
>> # If you want to use it, read CustomConfig.pm.
>> Always Looked Up Last = &Wrapper
>>
>>
>> In CustomConfig.pm
>>
>> sub InitWrapper {
>>  InitExtendedLogger();
>>  InitMailWatchLogging();
>> }
>>
>> sub Wrapper {
>>  my($msg) = @_;
>>  ExtendedLogger($msg);
>>  MailWatchLogging($msg);
>> }
>>
>> sub EndWrapper {
>>  EndExtendedLogger();
>>  EndMailWatchLogging();
>> }
>>
>> The sub Wrapper calls the functions, the InitWrapper calls the other 
>> Init
>> functions and EndWrapper calls the other End functions
>>
>> Rick
> Thanks Rick thats works like a treat - logging to both mysql and 
> postgres!
>
> I just realised another issue I have, the postgres set up has to use
>
> Quarantine Whole Messages As Queue Files = yes
>
> as when it releases a message it just copies the qf and df file to the 
> mqueue.
>
> Mailwatch requires
>
> Quarantine Whole Messages As Queue Files = no
>
> without changing to much code does anyone know how I can run with 
> both? i.e. quarantine files as both qf df and also as one file?
You have the source...

Jules

-- 
Julian Field MEng CITP CEng
www.MailScanner.info
Buy the MailScanner book at www.MailScanner.info/store

Need help customising MailScanner?
Contact me!
Need help fixing or optimising your systems?
Contact me!
Need help getting you started solving new requirements from your boss?
Contact me!

PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654
Follow me at twitter.com/JulesFM and twitter.com/MailScanner


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



More information about the MailScanner mailing list