Update of /cvsroot/mailman/mailman/Mailman/Bouncers
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11024/Mailman/Bouncers
Modified Files:
SimpleMatch.py
Log Message:
Added some more bounce recognition to SimpleMatch and changed the logic
so one all pattern sets are tried until a match is found so one start pattern
whose
address doesn't match won't preempt a later patern set that will match.
Added more test cases.
Index: SimpleMatch.py
===================================================================
RCS file: /cvsroot/mailman/mailman/Mailman/Bouncers/SimpleMatch.py,v
retrieving revision 2.15
retrieving revision 2.16
diff -u -d -r2.15 -r2.16
--- SimpleMatch.py 2 Feb 2006 16:16:31 -0000 2.15
+++ SimpleMatch.py 3 Mar 2006 18:53:58 -0000 2.16
@@ -87,6 +87,14 @@
(_c('Unable to deliver message to the following address\(es\)\.'),
_c('--- Original message follows\.'),
_c('<(?P<addr>[^>]*)>:')),
+ # kundenserver.de
+ (_c('A message that you sent could not be delivered'),
+ _c('^--- The header of the original'),
+ _c('<(?P<addr>[^>]*)>')),
+ # another kundenserver.de
+ (_c('A message that you sent could not be delivered'),
+ _c('^--- The header of the original'),
+ _c('^(?P<addr>[EMAIL PROTECTED]@[^\s@:]+):')),
# Next one goes here...
]
@@ -99,19 +107,27 @@
# 0 = nothing seen yet
# 1 = intro seen
addrs = {}
- state = 0
- for line in email.Iterators.body_line_iterator(msg):
- if state == 0:
- for scre, ecre, acre in patterns:
+ # MAS: This is a mess. The outer loop used to be over the message
+ # so we only looped through the message once. Looping through the
+ # message for each set of patterns is obviously way more work, but
+ # if we don't do it, problems arise because scre from the wrong
+ # pattern set matches first and then acre doesn't match. The
+ # alternative is to split things into separate modules, but then
+ # we process the message multiple times anyway.
+ for scre, ecre, acre in patterns:
+ state = 0
+ for line in email.Iterators.body_line_iterator(msg):
+ if state == 0:
if scre.search(line):
state = 1
+ if state == 1:
+ mo = acre.search(line)
+ if mo:
+ addr = mo.group('addr')
+ if addr:
+ addrs[mo.group('addr')] = 1
+ elif ecre.search(line):
break
- if state == 1:
- mo = acre.search(line)
- if mo:
- addr = mo.group('addr')
- if addr:
- addrs[mo.group('addr')] = 1
- elif ecre.search(line):
- break
+ if addrs:
+ break
return addrs.keys()
_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe:
http://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org