1
# Copyright (C) 2002-2003 by the Free Software Foundation, Inc.
1
# Copyright (C) 2002-2008 by the Free Software Foundation, Inc.
3
3
# This program is free software; you can redistribute it and/or
4
4
# modify it under the terms of the GNU General Public License
43
# There is an issue with addresses in To: or Cc: that differ in
44
# case from the MemberCPAddresses in recips. We can't just
45
# lower-case everything because we still want CP addresses in
46
# the final recips list, so we lower case the keys.
43
47
# Seed this set with addresses we don't care about dup avoiding
44
48
explicit_recips = {}
45
49
listaddrs = [mlist.GetListEmail(), mlist.GetBouncesEmail(),
46
50
mlist.GetOwnerEmail(), mlist.GetRequestEmail()]
47
51
for addr in listaddrs:
48
explicit_recips[addr] = True
52
explicit_recips[addr.lower()] = True
49
53
# Figure out the set of explicit recipients
51
55
for header in ('to', 'cc', 'resent-to', 'resent-cc'):
52
56
addrs = getaddresses(msg.get_all(header, []))
54
58
for name, addr in addrs:
55
ccaddrs[addr] = name, addr
59
ccaddrs[addr.lower()] = name, addr
56
60
for name, addr in addrs:
59
63
# Ignore the list addresses for purposes of dup avoidance
60
explicit_recips[addr] = True
64
explicit_recips[addr.lower()] = True
61
65
# Now strip out the list addresses
62
66
for addr in listaddrs:
63
del explicit_recips[addr]
67
del explicit_recips[addr.lower()]
64
68
if not explicit_recips:
65
69
# No one was explicitly addressed, so we can't do any dup collapsing
69
73
# If this recipient is explicitly addressed...
70
if explicit_recips.has_key(r):
74
if explicit_recips.has_key(r.lower()):
71
75
send_duplicate = True
72
76
# If the member wants to receive duplicates, or if the recipient
73
77
# is not a member at all, just flag the X-Mailman-Duplicate: yes
82
86
msgdata.setdefault('add-dup-header', {})[r] = True
83
87
newrecips.append(r)
84
elif ccaddrs.has_key(r):
88
elif ccaddrs.has_key(r.lower()):
89
del ccaddrs[r.lower()]
87
91
# Otherwise, this is the first time they've been in the recips
88
92
# list. Add them to the newrecips list and flag them as having