As requested, here is a diff against today's CVS

Index: TMDA/FilterParser.py
===================================================================
RCS file: /cvsroot/tmda/tmda/TMDA/FilterParser.py,v
retrieving revision 1.64
diff -u -r1.64 FilterParser.py
--- TMDA/FilterParser.py        30 Jan 2004 07:29:42 -0000      1.64
+++ TMDA/FilterParser.py        2 Feb 2004 17:58:13 -0000
@@ -238,10 +238,13 @@
     """, re.VERBOSE)
         
     tag_action = re.compile(r"""
-    ( [A-Za-z][-\w]+ )
-    \s+
-    (?: ([\'\"]) ( (?: \\\2 | . )+? ) \2
-    | ( \S+ ) )
+   ( [A-Za-z][-\w]+ ) 
+   \s+ 
+   (\w+\s*=\s*)?
+   (?: 
+        ([\'\"]) ( (?: \\\3 | . )+? ) \3
+       | ( \S+ ) 
+    )
     """, re.VERBOSE)
 
     in_action = re.compile(r"""
@@ -252,7 +255,7 @@
     
     out_action = re.compile(r"""
     ( (?:(?:bare|sender|domain|dated)(?:=\S+)?)
-    | (?:(?:exp(?:licit)?|as|ext(?:ension)?|kw|keyword)=\S+)
+    | (?:(?:exp(?:licit)?|as|ext(?:ension)?|kw|keyword|shell|python)=\S+)
     | default )""", re.VERBOSE | re.IGNORECASE)
     
     arg_option = re.compile(r'(\w+)(=?)')
@@ -650,7 +653,8 @@
                     errstr += 'malformed header field or missing <action>'
                     raise Error, errstr
                header = string.lower(mo.group(1))
-               action = mo.group(3) or mo.group(4)
+                action = mo.group(2) + (mo.group(4) or mo.group(5))
+                    
                 if action:
                     if not actions:
                         actions = {}
Index: bin/tmda-inject
===================================================================
RCS file: /cvsroot/tmda/tmda/bin/tmda-inject,v
retrieving revision 1.93
diff -u -r1.93 tmda-inject
--- bin/tmda-inject     1 Jan 2004 23:22:19 -0000       1.93
+++ bin/tmda-inject     2 Feb 2004 17:58:13 -0000
@@ -202,6 +202,17 @@
     elif cookie_type in ('kw','keyword') and cookie_option:
        # Send a message with a tagged (keyword) address.
        field = Cookie.make_keyword_address(from_address, cookie_option)
+    elif cookie_type == 'python':
+        field = str(eval(cookie_option))
+    elif cookie_type == 'shell':
+        # warning, this was written by a perl programmer.
+        field="";
+        fin, fout, ferr=os.popen3(cookie_option,"r")
+        for line in fout.readlines():
+            line=line.splitlines()[0]
+            if (len(field)>0):
+                field = field + " "
+            field+=line
     elif not cookie_type:
         # cookie_type == None means field is a text string
         field = cookie_option
@@ -294,7 +305,7 @@
     for header in custom_headers:
         (cookie_type, cookie_option) = actions[header]
         field = make_field(cookie_type, cookie_option, from_address, to_address)
-        if cookie_type:
+        if not (cookie_type in ('python','shell', None)):
             field = message_format(field, full_name,
                                    Defaults.MESSAGE_TAG_HEADER_STYLE)
         nice_header = string.capwords(header.replace('-', ' ')).replace(' ', '-')

_________________________________________________
tmda-workers mailing list ([EMAIL PROTECTED])
http://tmda.net/lists/listinfo/tmda-workers

Reply via email to