[prev in list] [next in list] [prev in thread] [next in thread] 

List:       tmda-cvs
Subject:    CVS: tmda/bin ChangeLog,1.94,1.95 tmda-inject,1.22,1.23
From:       "Jason R. Mastaler" <jasonrm () users ! sourceforge ! net>
Date:       2001-10-25 21:49:07
[Download RAW message or body]

Update of /cvsroot/tmda/tmda/bin
In directory usw-pr-cvs1:/tmp/cvs-serv29705/bin

Modified Files:
	ChangeLog tmda-inject 
Log Message:
Added KEYWORD_FILE (~/.tmda/lists/keyword) that contains
address/keyword pairs.  Upon a match, tmda-inject will tag the message
with a keyword address.

In the process fixed a bug that affects MTAs (such as Mutt) that pass
the recipients to the MTA as arguments.  The recipients weren't being
lowercased, which means mail sent to Jason@mastaler.com wouldn't match
jason@mastaler.com in lists/sender.  I didn't noticed this until now
because my primary MUA (Gnus) doesn't pass the recipients as
arguments.  Nasty, nasty, nasty.

Also for X-TMDA, added `extension' as an alias for `ext', and
`explicit' as an alias for `exp'.


Index: ChangeLog
===================================================================
RCS file: /cvsroot/tmda/tmda/bin/ChangeLog,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -r1.94 -r1.95
--- ChangeLog	2001/10/25 16:49:57	1.94
+++ ChangeLog	2001/10/25 21:49:04	1.95
@@ -1,7 +1,19 @@
 2001-10-25  Jason R. Mastaler  <jasonrm@nightshade.la.mastaler.com>
 
 	* tmda-inject (inject_message): Support MESSAGE_FROM_STYLE.
-	
+
+	(main): Add support for tagging messages with keyword addresses 
+	that match KEYWORD_FILE.
+
+	(main): Fixed a bug where if the recipient list was being passed
+	to tmda-inject, the recipient addresses were not being lowercased.
+	This resulted in a negative match with the listfiles if their
+	cases differed.  (i.e, mail sent to Jason@mastaler.com wouldn't
+	match jason@mastaler.com in lists/sender).
+
+	(main): For X-TMDA:, add `extension' as an alias for `ext', and
+	`explicit' as an alias for `exp'.
+
 2001-10-24  Jason R. Mastaler  <jasonrm@nightshade.la.mastaler.com>
 
 	* tmda-filter (verify_confirm_cookie): Make sure the cookie

Index: tmda-inject
===================================================================
RCS file: /cvsroot/tmda/tmda/bin/tmda-inject,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- tmda-inject	2001/10/25 16:49:58	1.22
+++ tmda-inject	2001/10/25 21:49:04	1.23
@@ -143,6 +143,7 @@
     x_tmda_over = None
     exp_from_address = None
     ext_extension = None
+    keyword_extension = None
 
     # Use the existing From: header if possible.
     (fullname, from_address) = message_headers.getaddr("from")
@@ -161,9 +162,11 @@
     # Read in the message body.
     message_body = message.read()
     
-    # If recipients are provided as args, use them.
+    # If recipients were provided as args, use them (after lowercasing).
     if args:
-	address_list = args
+        address_list = []
+        for a in args:
+            address_list.append(string.lower(a))
     # If running through qfilter, get recipient list from QMAILRCPTS.
     elif os.environ.has_key('QMAILRCPTS'):
         address_list = string.split(string.lower
@@ -190,11 +193,11 @@
                 pass
         elif tagtype in ('bare','sender'):
             address_cookie = tagtype
-        elif tagtype == 'exp':
-            address_cookie = tagtype
+        elif tagtype in ('exp','explicit'):
+            address_cookie = 'exp'
             exp_from_address = fields[1]
-        elif tagtype == 'ext':
-            address_cookie = tagtype
+        elif tagtype in ('ext','extension'):
+            address_cookie = 'ext'
             ext_extension = fields[1]
         elif tagtype in ('kw','keyword'):
             address_cookie = 'keyword'
@@ -219,6 +222,10 @@
         if os.path.exists(Defaults.SENDER_FILE):
             sender_list = Util.file_to_list(Defaults.SENDER_FILE,sender_list)
 
+        keyword_list = []
+        if os.path.exists(Defaults.KEYWORD_FILE):
+            keyword_list = Util.file_to_list(Defaults.KEYWORD_FILE,keyword_list)
+
         exp_list = []
         if os.path.exists(Defaults.EXP_FILE):
             exp_list = Util.file_to_list(Defaults.EXP_FILE,exp_list)
@@ -246,13 +253,16 @@
         else:
             exp_match = Util.findmatch(exp_list,address)
             ext_match = Util.findmatch(ext_list,address)
-        
+            keyword_match = Util.findmatch(keyword_list,address)
             if exp_match:
                 address_cookie = 'exp'
                 if not exp_from_address:exp_from_address = exp_match
             elif ext_match:
                 address_cookie = 'ext'
                 if not ext_extension:ext_extension = ext_match
+            elif keyword_match:
+                address_cookie = 'keyword'
+                if not keyword_extension:keyword_extension = keyword_match
             else:
                 address_cookie = Defaults.COOKIE_TYPE
 

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic