aboutsummaryrefslogtreecommitdiffstats
path: root/Mailman/Handlers/Cleanse.py
diff options
context:
space:
mode:
authorMark Sapiro <mark@msapiro.net>2013-07-18 20:49:20 -0700
committerMark Sapiro <mark@msapiro.net>2013-07-18 20:49:20 -0700
commit9b8cf403719c083270b2d51a0aac22e120355522 (patch)
tree3aff142848d1c3d60aa044e29c6d1c549174fb91 /Mailman/Handlers/Cleanse.py
parentcb2733e029d419904f0fc488f5989beb3aa3ce71 (diff)
downloadmailman2-9b8cf403719c083270b2d51a0aac22e120355522.tar.gz
mailman2-9b8cf403719c083270b2d51a0aac22e120355522.tar.xz
mailman2-9b8cf403719c083270b2d51a0aac22e120355522.zip
First cut at the author_is_list feature.
Diffstat (limited to '')
-rw-r--r--Mailman/Handlers/Cleanse.py24
1 files changed, 22 insertions, 2 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',