diff options
author | Mark Sapiro <mark@msapiro.net> | 2019-11-08 13:04:52 -0800 |
---|---|---|
committer | Mark Sapiro <mark@msapiro.net> | 2019-11-08 13:04:52 -0800 |
commit | f40c586ab27bf0a1fb7d720b150310f26b0c5e5e (patch) | |
tree | 3e218cbffe86a222f2baf129b17890872846aad1 /Mailman/Handlers | |
parent | 266227cbf41048261a8d9ad213434bbc4f9dff3a (diff) | |
download | mailman2-f40c586ab27bf0a1fb7d720b150310f26b0c5e5e.tar.gz mailman2-f40c586ab27bf0a1fb7d720b150310f26b0c5e5e.tar.xz mailman2-f40c586ab27bf0a1fb7d720b150310f26b0c5e5e.zip |
Implement new drop_cc switch.
Diffstat (limited to 'Mailman/Handlers')
-rw-r--r-- | Mailman/Handlers/AvoidDuplicates.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Mailman/Handlers/AvoidDuplicates.py b/Mailman/Handlers/AvoidDuplicates.py index 25c1b410..0e6e2229 100644 --- a/Mailman/Handlers/AvoidDuplicates.py +++ b/Mailman/Handlers/AvoidDuplicates.py @@ -53,6 +53,7 @@ def process(mlist, msg, msgdata): explicit_recips[addr.lower()] = True # Figure out the set of explicit recipients ccaddrs = {} + munge_cc = False for header in ('to', 'cc', 'resent-to', 'resent-cc'): addrs = getaddresses(msg.get_all(header, [])) if header == 'cc': @@ -88,6 +89,7 @@ def process(mlist, msg, msgdata): newrecips.append(r) elif ccaddrs.has_key(r.lower()): del ccaddrs[r.lower()] + munge_cc = True 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 @@ -96,10 +98,13 @@ def process(mlist, msg, msgdata): # Set the new list of recipients msgdata['recips'] = newrecips # RFC 2822 specifies zero or one CC header - if ccaddrs: + if ccaddrs and mlist.drop_cc and munge_cc: + # There are remaining Ccs and we've dropped one or more and the list + # allows changing. change_header('Cc', COMMASPACE.join([formataddr(i) for i in ccaddrs.values()]), mlist, msg, msgdata) - else: + elif not ccaddrs and mlist.drop_cc: + # The list allows changing and there are no remaining Ccs del msg['cc'] |