logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

CVS: tmda/TMDA ChangeLog,1.155,1.156 FilterParser.py,1.26,1.27: msg#00079

Subject: CVS: tmda/TMDA ChangeLog,1.155,1.156 FilterParser.py,1.26,1.27
Update of /cvsroot/tmda/tmda/TMDA
In directory usw-pr-cvs1:/tmp/cvs-serv31217

Modified Files:
        ChangeLog FilterParser.py 
Log Message:
Added support for options on incoming actions.  This is for Jason's new
'deliver' code.


Index: ChangeLog
===================================================================
RCS file: /cvsroot/tmda/tmda/TMDA/ChangeLog,v
retrieving revision 1.155
retrieving revision 1.156
diff -u -r1.155 -r1.156
--- ChangeLog   22 Feb 2002 02:10:34 -0000      1.155
+++ ChangeLog   22 Feb 2002 03:43:01 -0000      1.156
@@ -1,3 +1,11 @@
+2002-02-21  Tim Legant  <tim@xxxxxxxxxxx>
+
+       * FilterParser.py (FilterParser): Modified 'in_action' and
+       'action_option' regexps to handle new option on 'deliver' action.
+       
+       (FilterParser.__buildactions): Allowed incoming filter actions to
+       have options.
+
 2002-02-21  Jason R. Mastaler  <jasonrm@xxxxxxxxxxxxxxxxxxxxxxxxxx>
 
        * Defaults.py: raise TMDA.Errors.ConfigError for tmdarc problems

Index: FilterParser.py
===================================================================
RCS file: /cvsroot/tmda/tmda/TMDA/FilterParser.py,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- FilterParser.py     22 Feb 2002 01:14:35 -0000      1.26
+++ FilterParser.py     22 Feb 2002 03:43:01 -0000      1.27
@@ -72,15 +72,17 @@
     | ( \S+ ) )
     """, re.VERBOSE)
 
-    in_action = 
re.compile(r'(bounce|reject|drop|exit|stop|ok|accept|deliver|confirm)',
-                           re.IGNORECASE)
+    in_action = re.compile(r"""
+    (bounce|reject|drop|exit|stop|ok|accept|confirm
+    | deliver(?:\s*=.*$)? )
+    """, re.VERBOSE | re.IGNORECASE)
     
     out_action = re.compile(r"""
     ( (?:(?:bare|sender|dated)(?:=\S+)?)
     | (?:(?:exp(?:licit)?|as|ext(?:ension)?|kw|keyword)=\S+)
     | default )""", re.VERBOSE | re.IGNORECASE)
     
-    action_option = re.compile(r'(\w+)(?:=(\S+))?')
+    action_option = re.compile(r'(\w+)(?:\s*=\s*(.*)$)?')
 
     arg_option = re.compile(r'(\w+)(=?)')
 
@@ -252,10 +254,19 @@
                       filename or a regular expression enclosed within
                       parentheses
          actions   - dictionary: a dictionary with a key of 'action' and
-                      a value that is a tuple. The value tuple contains
-                      the 'cookie' type and the 'cookie' option. Ex:
-                        { 'accept' : ( None, None ) }           # incoming
-                        { 'from' : ( 'exp', 'tim@xxxxxxxxxxx' ) # outgoing
+                      a value that is a tuple.
+
+                      Incoming actions have key 'incoming' and the tuple
+                      contains the action and an optional parameter.
+
+                        { 'incoming' : ( 'deliver', '&tim@xxxxxxxxxxx' ) }
+
+                      Outgoing actions have the relevant header as the key and
+                      the tuple contains the 'cookie' type and the 'cookie'
+                      option.
+
+                        { 'from' : ( 'exp', 'tim@xxxxxxxxxxx' ) }
+
                       In the case of the outgoing filter, the dictionary may 
have
                       more than one entry. In fact, that's the reason we use a
                       dictionary. The rather silly looking incoming entry is a
@@ -319,7 +330,7 @@
            mo = self.in_action.match(action_line)
            if mo:
                if len(action_line) == len(mo.group(1)):
-                    actions = { action_line.lower() : (None, None) }
+                    actions = { 'incoming' : splitaction(action_line) }
                else:
                    # invalid incoming action (extra stuff on line)
                    raise Error, '"%s": garbage at end of line' % source

_______________________________________________
tmda-cvs mailing list
http://libertine.org/lists/listinfo/tmda-cvs



<Prev in Thread] Current Thread [Next in Thread>