summaryrefslogtreecommitdiff
path: root/src/mailman/pipeline/cook_headers.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailman/pipeline/cook_headers.py')
-rw-r--r--src/mailman/pipeline/cook_headers.py70
1 files changed, 1 insertions, 69 deletions
diff --git a/src/mailman/pipeline/cook_headers.py b/src/mailman/pipeline/cook_headers.py
index 7e7b2078b..0afa52b0c 100644
--- a/src/mailman/pipeline/cook_headers.py
+++ b/src/mailman/pipeline/cook_headers.py
@@ -32,14 +32,12 @@ from email.header import Header, decode_header, make_header
from email.utils import parseaddr, formataddr, getaddresses
from zope.interface import implements
-from mailman.config import config
from mailman.core.i18n import _
from mailman.interfaces.handler import IHandler
from mailman.interfaces.mailinglist import Personalization, ReplyToMunging
from mailman.version import VERSION
-CONTINUATION = ',\n\t'
COMMASPACE = ', '
MAXLINELEN = 78
@@ -87,9 +85,6 @@ def process(mlist, msg, msgdata):
# TK: Sometimes subject header is not MIME encoded for 8bit
# simply abort prefixing.
pass
- # Mark message so we know we've been here, but leave any existing
- # X-BeenThere's intact.
- msg['X-BeenThere'] = mlist.posting_address
# Add Precedence: and other useful headers. None of these are standard
# and finding information on some of them are fairly difficult. Some are
# just common practice, and we'll add more here as they become necessary.
@@ -173,75 +168,12 @@ def process(mlist, msg, msgdata):
add((str(i18ndesc), mlist.posting_address))
del msg['Cc']
msg['Cc'] = COMMASPACE.join([formataddr(pair) for pair in new])
- # Add list-specific headers as defined in RFC 2369 and RFC 2919, but only
- # if the message is being crafted for a specific list (e.g. not for the
- # password reminders).
- #
- # BAW: Some people really hate the List-* headers. It seems that the free
- # version of Eudora (possibly on for some platforms) does not hide these
- # headers by default, pissing off their users. Too bad. Fix the MUAs.
- if msgdata.get('_nolist') or not mlist.include_rfc2369_headers:
- return
- # This will act like an email address for purposes of formataddr()
- if mlist.description:
- # Don't wrap the header since here we just want to get it properly RFC
- # 2047 encoded.
- i18ndesc = uheader(mlist, mlist.description, 'List-Id', maxlinelen=998)
- listid_h = formataddr((str(i18ndesc), mlist.list_id))
- else:
- # without desc we need to ensure the MUST brackets
- listid_h = '<{0}>'.format(mlist.list_id)
- # No other agent should add a List-ID header except Mailman.
- del msg['list-id']
- msg['List-Id'] = listid_h
- # For internally crafted messages, we also add a (nonstandard),
- # "X-List-Administrivia: yes" header. For all others (i.e. those coming
- # from list posts), we add a bunch of other RFC 2369 headers.
- requestaddr = mlist.request_address
- subfieldfmt = '<{0}>, <mailto:{1}>'
- listinfo = mlist.script_url('listinfo')
- headers = {}
- # XXX reduced_list_headers used to suppress List-Help, List-Subject, and
- # List-Unsubscribe from UserNotification. That doesn't seem to make sense
- # any more, so always add those three headers (others will still be
- # suppressed).
- headers.update({
- 'List-Help' : '<mailto:{0}?subject=help>'.format(requestaddr),
- 'List-Unsubscribe': subfieldfmt.format(listinfo, mlist.leave_address),
- 'List-Subscribe' : subfieldfmt.format(listinfo, mlist.join_address),
- })
- if msgdata.get('reduced_list_headers'):
- headers['X-List-Administrivia'] = 'yes'
- else:
- # List-Post: is controlled by a separate attribute
- if mlist.include_list_post_header:
- headers['List-Post'] = '<mailto:{0}>'.format(mlist.posting_address)
- # Add RFC 2369 and 5064 archiving headers, if archiving is enabled.
- if mlist.archive:
- for archiver in config.archivers:
- headers['List-Archive'] = '<{0}>'.format(
- archiver.list_url(mlist))
- permalink = archiver.permalink(mlist, msg)
- if permalink is not None:
- headers['Archived-At'] = permalink
- # XXX RFC 2369 also defines a List-Owner header which we are not currently
- # supporting, but should.
- for h, v in headers.items():
- # First we delete any pre-existing headers because the RFC permits
- # only one copy of each, and we want to be sure it's ours.
- del msg[h]
- # Wrap these lines if they are too long. 78 character width probably
- # shouldn't be hardcoded, but is at least text-MUA friendly. The
- # adding of 2 is for the colon-space separator.
- if len(h) + 2 + len(v) > 78:
- v = CONTINUATION.join(v.split(', '))
- msg[h] = v
def prefix_subject(mlist, msg, msgdata):
"""Maybe add a subject prefix.
-
+
Add the subject prefix unless the message is a digest or is being fast
tracked (e.g. internally crafted, delivered to a single user such as the
list admin).