Re: [AMaViS-user] Subject Tag Templates with Macro Expansion

This is a discussion on Re: [AMaViS-user] Subject Tag Templates with Macro Expansion within the Amavis User forums, part of the Anti-Spam and Anti-Virus Related Forums category; Joel Nimety wrote: > > Gary V wrote: >> Joel wrote: >> >>> In our environment ...


Go Back   Usenet Forums > Anti-Spam and Anti-Virus Related Forums > Amavis User

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-13-2006
Joel Nimety
 
Posts: n/a
Default Re: [AMaViS-user] Subject Tag Templates with Macro Expansion

Joel Nimety wrote:
>
> Gary V wrote:
>> Joel wrote:
>>
>>> In our environment it would be useful to allow subject tag customization
>>> much like the existing ability to customize notifications using
>>> templates (including macro expansion). We currently have a requirement
>>> to add the raw spamassassin score to the subject or a confidence score
>>> (as a percentage, using the kill_level as 100%). If you don't mind,
>>> please answer a few questions before I get started...
>>> 1) Is anyone else working on such a functionality?
>>> 2) Is there a helper function for the notification templates that I can
>>> use for macro expansion?
>>> 3) Is add_forwarding_header_edits_per_recip the proper place to modify
>>> the subject_tag?
>>> Your comments are much appreciated.

>> http://marc.theaimsgroup.com/?l=amav...7239616558&w=2

>
> Thanks. I will use this patch as a starting point but I was going to
> implement something that could use the same/similar macro expansion as
> the notification templates. This way the subject_tag template could be
> defined on a per recipient basis using LDAP/SQL instead of harcoded in
> amavisd.


Since my first attempt at sending this is awaiting moderator approval...

Find below a first attempt at providing macro expansion within the
subject tag. Patch is against 2.4.2. I've tested it with LDAP but it
should work with SQL and spam_subject_tag*_maps as well. Two macros have
been added (kill_level and percent_score) for use in the subject.
Comments, suggestions, and criticism are welcome.

--- amavisd-new-2.4.2/amavisd 2006-06-27 07:31:56.000000000 -0400
+++ amavisd-new-2.4.2/amavisd 2006-07-12 12:38:32.000000000 -0400
@@ -8469,12 +8469,24 @@
}
my($subject_insert); # concatenation of triggered subject tag strings
if ($do_subj || $do_subj_u) {
+ my(%mybuiltins) = %builtins; # make a local copy
+ my($sl) = !defined($spam_level) ? 'x'
+ : 0+sprintf("%.3f",$spam_level); # trim fraction
+ $mybuiltins{'kill_level'} = lookup(0,$recip,
@{ca('spam_kill_level_maps')});
+ $mybuiltins{'percent_score'} = $sl eq 'x' ? 'x'
+ : $sl/$mybuiltins{'kill_level'}*100 > 100 ? 100
+ : 0+sprintf("%.3f", $sl/$mybuiltins{'kill_level'}*100);
if ($do_subj_u) {
$subject_insert = c('undecipherable_subject_tag');
+ my($strr) = expand(\$subject_insert, \%mybuiltins);
+ $subject_insert = $$strr; # replace with macro expanded copy
do_log(3,"adding %s, %s, %s",
$subject_insert, $any_undecipherable, $hold);
}
- $subject_insert .= $subject_tag if $do_subj;
+ if ($do_subj){
+ my($strr) = expand(\$subject_tag, \%mybuiltins);
+ $subject_insert .= $$strr; # append macro expanded copy
+ }
}
my($key) = join("\000", map {defined $_ ? $_ : ''} (
$do_tag_virus_checked, $do_tag_virus, $do_tag_banned, $do_tag_badh,


--
Joel Nimety




--
The sender of this email subscribes to Perimeter Internetworking's email
anti-virus service. This email has been scanned for malicious code and is
believed to be virus free. For more information on email security please visit:
http://www.perimeterusa.com/maliciou...e_content.html

This communication is confidential, intended only for the named recipient(s)
above and may contain trade secrets or other information that is exempt from
disclosure under applicable law. Any use, dissemination, distribution or
copying of this communication by anyone other than the named recipient(s) is
strictly prohibited. If you have received this communication in error, please
delete the email and immediately notify our Command Center at 203-541-3444.


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=...057&dat=121642
_______________________________________________
AMaViS-user mailing list
AMaViS-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/...fo/amavis-user
AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3
AMaViS-HowTos:http://www.amavis.org/howto/
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 09:32 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0