diff options
author | Mark Sapiro <mark@msapiro.net> | 2013-07-18 20:49:20 -0700 |
---|---|---|
committer | Mark Sapiro <mark@msapiro.net> | 2013-07-18 20:49:20 -0700 |
commit | 9b8cf403719c083270b2d51a0aac22e120355522 (patch) | |
tree | 3aff142848d1c3d60aa044e29c6d1c549174fb91 /Mailman/Handlers | |
parent | cb2733e029d419904f0fc488f5989beb3aa3ce71 (diff) | |
download | mailman2-9b8cf403719c083270b2d51a0aac22e120355522.tar.gz mailman2-9b8cf403719c083270b2d51a0aac22e120355522.tar.xz mailman2-9b8cf403719c083270b2d51a0aac22e120355522.zip |
First cut at the author_is_list feature.
Diffstat (limited to 'Mailman/Handlers')
-rw-r--r-- | Mailman/Handlers/Cleanse.py | 24 | ||||
-rw-r--r-- | Mailman/Handlers/CleanseDKIM.py | 13 | ||||
-rwxr-xr-x | Mailman/Handlers/CookHeaders.py | 7 |
3 files changed, 34 insertions, 10 deletions
diff --git a/Mailman/Handlers/Cleanse.py b/Mailman/Handlers/Cleanse.py index 725cb41b..678f6b56 100644 --- a/Mailman/Handlers/Cleanse.py +++ b/Mailman/Handlers/Cleanse.py @@ -1,4 +1,4 @@ -# Copyright (C) 1998-2010 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2013 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 @@ -19,7 +19,7 @@ import re -from email.Utils import formataddr +from email.Utils import formataddr, getaddresses, parseaddr from Mailman.Utils import unique_message_id from Mailman.Logging.Syslog import syslog @@ -38,6 +38,26 @@ def process(mlist, msg, msgdata): del msg['x-approve'] # Also remove this header since it can contain a password del msg['urgent'] + # Do we change the from so the list takes ownership of the email + # This really belongs in CookHeaders. + if mlist.author_is_list: + realname, email = parseaddr(msg['from']) + replies = getaddresses(msg.get('reply-to', '')) + reply_addrs = [x[1].lower() for x in replies] + if reply_addrs: + if email.lower() not in reply_addrs: + rt = msg['reply-to'] + ', ' + msg['from'] + else: + rt = msg['reply-to'] + else: + rt = msg['from'] + del msg['reply-to'] + msg['Reply-To'] = rt + del msg['from'] + msg['From'] = formataddr(('%s via %s' % (realname, mlist.real_name), + mlist.GetListEmail())) + del msg['sender'] + #MAS mlist.include_sender_header = 0 # We remove other headers from anonymous lists if mlist.anonymous_list: syslog('post', 'post to %s from %s anonymized', diff --git a/Mailman/Handlers/CleanseDKIM.py b/Mailman/Handlers/CleanseDKIM.py index c4b06613..3a157890 100644 --- a/Mailman/Handlers/CleanseDKIM.py +++ b/Mailman/Handlers/CleanseDKIM.py @@ -1,4 +1,4 @@ -# Copyright (C) 2006-2007 by the Free Software Foundation, Inc. +# Copyright (C) 2006-2013 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 @@ -29,8 +29,11 @@ from Mailman import mm_cfg def process(mlist, msg, msgdata): - if mm_cfg.REMOVE_DKIM_HEADERS: - del msg['domainkey-signature'] - del msg['dkim-signature'] - del msg['authentication-results'] + if not mm_cfg.REMOVE_DKIM_HEADERS: + return + if mm_cfg.REMOVE_DKIM_HEADERS == 1 and not mlist.author_is_list: + return + del msg['domainkey-signature'] + del msg['dkim-signature'] + del msg['authentication-results'] diff --git a/Mailman/Handlers/CookHeaders.py b/Mailman/Handlers/CookHeaders.py index a2096172..7455dcc6 100755 --- a/Mailman/Handlers/CookHeaders.py +++ b/Mailman/Handlers/CookHeaders.py @@ -1,4 +1,4 @@ -# Copyright (C) 1998-2011 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2013 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 @@ -157,9 +157,10 @@ def process(mlist, msg, msgdata): # Cc header. BAW: should we force it into a Reply-To header in the # above code? # Also skip Cc if this is an anonymous list as list posting address - # is already in From and Reply-To in this case. + # is already in From and Reply-To in this case and similarly for + # an 'author is list' list. if mlist.personalize == 2 and mlist.reply_goes_to_list <> 1 \ - and not mlist.anonymous_list: + and not mlist.anonymous_list and not mlist.author_is_list: # Watch out for existing Cc headers, merge, and remove dups. Note # that RFC 2822 says only zero or one Cc header is allowed. new = [] |