diff options
author | David Planella <david.planella@gmail.com> | 2008-11-22 21:32:49 +0100 |
---|---|---|
committer | David Planella <david.planella@gmail.com> | 2008-11-22 21:32:49 +0100 |
commit | 85aae3995be31a5f10cf65235f15038dbdcdb261 (patch) | |
tree | 38d0ed32dee807f463656fcb98cf579ce952fc6a /Mailman/Handlers/AvoidDuplicates.py | |
parent | 9476341ddf99f5a5138c2dc81c84a797b2c81579 (diff) | |
parent | f0d392172bb2400927948004d2dc66c264ca2aa5 (diff) | |
download | mailman2-85aae3995be31a5f10cf65235f15038dbdcdb261.tar.gz mailman2-85aae3995be31a5f10cf65235f15038dbdcdb261.tar.xz mailman2-85aae3995be31a5f10cf65235f15038dbdcdb261.zip |
Merged from upstream (lp:mailman/stable)
Upgraded the repository format with 'bzr upgrade'
Diffstat (limited to 'Mailman/Handlers/AvoidDuplicates.py')
-rw-r--r-- | Mailman/Handlers/AvoidDuplicates.py | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/Mailman/Handlers/AvoidDuplicates.py b/Mailman/Handlers/AvoidDuplicates.py index fdcc49ca..038034c7 100644 --- a/Mailman/Handlers/AvoidDuplicates.py +++ b/Mailman/Handlers/AvoidDuplicates.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2003 by the Free Software Foundation, Inc. +# Copyright (C) 2002-2008 by the Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -40,34 +40,38 @@ def process(mlist, msg, msgdata): # Short circuit if not recips: return + # There is an issue with addresses in To: or Cc: that differ in + # case from the MemberCPAddresses in recips. We can't just + # lower-case everything because we still want CP addresses in + # the final recips list, so we lower case the keys. # Seed this set with addresses we don't care about dup avoiding explicit_recips = {} listaddrs = [mlist.GetListEmail(), mlist.GetBouncesEmail(), mlist.GetOwnerEmail(), mlist.GetRequestEmail()] for addr in listaddrs: - explicit_recips[addr] = True + explicit_recips[addr.lower()] = True # Figure out the set of explicit recipients ccaddrs = {} for header in ('to', 'cc', 'resent-to', 'resent-cc'): addrs = getaddresses(msg.get_all(header, [])) if header == 'cc': for name, addr in addrs: - ccaddrs[addr] = name, addr + ccaddrs[addr.lower()] = name, addr for name, addr in addrs: if not addr: continue # Ignore the list addresses for purposes of dup avoidance - explicit_recips[addr] = True + explicit_recips[addr.lower()] = True # Now strip out the list addresses for addr in listaddrs: - del explicit_recips[addr] + del explicit_recips[addr.lower()] if not explicit_recips: # No one was explicitly addressed, so we can't do any dup collapsing return newrecips = [] for r in recips: # If this recipient is explicitly addressed... - if explicit_recips.has_key(r): + if explicit_recips.has_key(r.lower()): send_duplicate = True # If the member wants to receive duplicates, or if the recipient # is not a member at all, just flag the X-Mailman-Duplicate: yes @@ -81,8 +85,8 @@ def process(mlist, msg, msgdata): if send_duplicate: msgdata.setdefault('add-dup-header', {})[r] = True newrecips.append(r) - elif ccaddrs.has_key(r): - del ccaddrs[r] + elif ccaddrs.has_key(r.lower()): + del ccaddrs[r.lower()] else: # Otherwise, this is the first time they've been in the recips # list. Add them to the newrecips list and flag them as having |