summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbwarsaw1999-11-10 17:50:24 +0000
committerbwarsaw1999-11-10 17:50:24 +0000
commit07d6b93370b08e91269fb5e7238e406e42123220 (patch)
tree423ee7045210395231223eb7336995f44201e6cb
parent8c188aca6fc1ff5fb6b1cbaeae3bb2e1b0788422 (diff)
downloadmailman-07d6b93370b08e91269fb5e7238e406e42123220.tar.gz
mailman-07d6b93370b08e91269fb5e7238e406e42123220.tar.zst
mailman-07d6b93370b08e91269fb5e7238e406e42123220.zip
New pipeline delivery module
"""Cook a message's Subject header. Use Cleanse.py module to actually remove various headers. """
-rw-r--r--Mailman/Handlers/CookHeaders.py84
1 files changed, 84 insertions, 0 deletions
diff --git a/Mailman/Handlers/CookHeaders.py b/Mailman/Handlers/CookHeaders.py
new file mode 100644
index 000000000..8d7c7fa6d
--- /dev/null
+++ b/Mailman/Handlers/CookHeaders.py
@@ -0,0 +1,84 @@
+# Copyright (C) 1998 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
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+"""Cook a message's Subject header.
+
+Use Cleanse.py module to actually remove various headers.
+"""
+
+import re
+from Mailman import mm_cfg
+
+
+
+def process(mlist, msg):
+ subject = msg.getheader('subject')
+ prefix = mlist.subject_prefix
+ adminaddr = mlist.GetAdminEmail()
+ # we purposefully leave no space b/w prefix and subject!
+ if not subject:
+ msg['Subject'] = prefix + '(no subject)'
+ elif prefix and not re.search(re.escape(prefix), subject, re.I):
+ msg['Subject'] = prefix + subject
+ #
+ # get rid of duplicate headers
+ del msg['sender']
+ del msg['errors-to']
+ msg['Sender'] = adminaddr
+ msg['Errors-To'] = adminaddr
+ #
+ # Mark message so we know we've been here
+ msg['X-BeenThere'] = mlist.GetListEmail()
+ #
+ # 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.
+ # A good place to look is
+ #
+ # http://www.dsv.su.se/~jpalme/ietf/jp-ietf-home.html
+ #
+ # None of these headers are added if they already exist
+ if not msg.get('x-mailman-version'):
+ msg['X-Mailman-Version'] = mm_cfg.VERSION
+ # semi-controversial: some don't want this included at all, others
+ # want the value to be `list'
+ if not msg.get('precedence'):
+ msg['Precedence'] = 'bulk'
+ #
+ # Other list related non-standard headers. Defined in:
+ #
+ # Grant Neufeld and Joshua D. Baer: The Use of URLs as Meta-Syntax for
+ # Core Mail List Commands and their Transport through Message Header
+ # fields, draft-baer-listspec-01.txt, September 1997.
+ #
+ # Referenced in
+ #
+ # http://www.dsv.su.se/~jpalme/ietf/mail-attributes.html
+ #
+ if not msg.get('list-id'):
+ msg['List-Id'] = mlist.GetListIdentifier()
+ #
+ # These currently seem like overkill. Maybe add them in later when
+ # the draft gets closer to a standard
+ #
+ # List-Subscribe
+ # List-Unsubscribe
+ # List-Owner
+ # List-Help
+ # List-Post
+ # List-Archive
+ # List-Software
+ # X-Listserver