CVS: tmda/bin ChangeLog,1.275,1.276 tmda-rfilter,1.95,1.96

"Jason R. Mastaler" <[email protected]>
Newsgroups gmane.mail.spam.tmda.cvs
Message-ID <[email protected]>
Update of /cvsroot/tmda/tmda/bin
In directory sc8-pr-cvs1:/tmp/cvs-serv26285/bin

Modified Files:
	ChangeLog tmda-rfilter 
Log Message:
New feature.  The bounce,reject FILTER_INCOMING action now takes an
optional 'template' argument to bounce using a specific template
rather than the default template (bounce.txt).

The argument can either be an absolute pathname (including tilde
expansion) or a relative (to TEMPLATE_DIR) pathname.  Assuming
TEMPLATE_DIR is set to ~/.tmda/templates, each of the following
instructions are equivalent:

 from johndoe* bounce = /users/jasonrm/.tmda/templates/bounce_freemail.txt
 from johndoe* bounce = ~/.tmda/templates/bounce_freemail.txt
 from johndoe* bounce = ~jasonrm/.tmda/templates/bounce_freemail.txt
 from johndoe* bounce = bounce_freemail.txt


Index: ChangeLog
===================================================================
RCS file: /cvsroot/tmda/tmda/bin/ChangeLog,v
retrieving revision 1.275
retrieving revision 1.276
diff -u -r1.275 -r1.276
--- ChangeLog	29 May 2003 18:25:41 -0000	1.275
+++ ChangeLog	9 Jun 2003 02:20:51 -0000	1.276
@@ -1,3 +1,10 @@
+2003-06-08  Jason R. Mastaler  <[email protected]>
+
+	* tmda-rfilter (bouncegen): Add a 'template' function parameter,
+	which defaults to None.
+
+	(main): Support bounce=template FILTER_INCOMING instructions.
+		
 2003-05-30  Jason R. Mastaler  <[email protected]>
 
 	* tmda-rfilter (recipient_address): export TMDA_RECIPIENT to the

Index: tmda-rfilter
===================================================================
RCS file: /cvsroot/tmda/tmda/bin/tmda-rfilter,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -r1.95 -r1.96
--- tmda-rfilter	29 May 2003 18:25:42 -0000	1.95
+++ tmda-rfilter	9 Jun 2003 02:20:52 -0000	1.96
@@ -603,7 +603,7 @@
     return pending_message
 
 
-def bouncegen(mode, text=None):
+def bouncegen(mode, text=None, template=None):
     """Bounce a message back to sender."""
     # Stop right away if --discard was specified.
     if discard:
@@ -639,7 +639,10 @@
         if text is None:
             mta.stop()
         else:
-            templatefile = 'bounce.txt'
+            if template:
+                templatefile = template
+            else:
+                templatefile = 'bounce.txt'
             bounce_text = Util.wraptext(text)
     elif mode == 'request':               # confirmation requests
         templatefile = 'confirm_request.txt'
@@ -750,8 +753,13 @@
     if action in ('bounce','reject'):
         if Defaults.FILTER_BOUNCE_CC:
             send_cc(Defaults.FILTER_BOUNCE_CC)
-        logit('%s (%s)' % ('BOUNCE', matching_line))
-        bouncegen('bounce', Defaults.BOUNCE_TEXT_FILTER_INCOMING)
+        if option:
+            logit('%s (%s)' % ('BOUNCE', matching_line + '=' + option))
+            bouncegen('bounce', Defaults.BOUNCE_TEXT_FILTER_INCOMING,
+                      template=option)
+        else:
+            logit('%s (%s)' % ('BOUNCE', matching_line))
+            bouncegen('bounce', Defaults.BOUNCE_TEXT_FILTER_INCOMING)
     elif action in ('drop','exit','stop'):
         if Defaults.FILTER_DROP_CC:
             send_cc(Defaults.FILTER_DROP_CC)

_______________________________________
tmda-cvs mailing list
http://tmda.net/lists/listinfo/tmda-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.