aboutsummaryrefslogtreecommitdiffstats
path: root/Mailman/Queue/NewsRunner.py
diff options
context:
space:
mode:
authorMark Sapiro <mark@msapiro.net>2016-04-02 23:18:40 -0700
committerMark Sapiro <mark@msapiro.net>2016-04-02 23:18:40 -0700
commit52c355755a5b33c975ec9b3a7535236685bf0c18 (patch)
tree5b5c5d1d2dd64071d81337ca91f62c695fcf7a7c /Mailman/Queue/NewsRunner.py
parentbfb1ec8088bbb03f93c344274a315adaf96897bf (diff)
downloadmailman2-52c355755a5b33c975ec9b3a7535236685bf0c18.tar.gz
mailman2-52c355755a5b33c975ec9b3a7535236685bf0c18.tar.xz
mailman2-52c355755a5b33c975ec9b3a7535236685bf0c18.zip
Attempt to improve threading of posts gated to Usenet.
Diffstat (limited to 'Mailman/Queue/NewsRunner.py')
-rw-r--r--Mailman/Queue/NewsRunner.py26
1 files changed, 23 insertions, 3 deletions
diff --git a/Mailman/Queue/NewsRunner.py b/Mailman/Queue/NewsRunner.py
index 449532fb..d62cb8dd 100644
--- a/Mailman/Queue/NewsRunner.py
+++ b/Mailman/Queue/NewsRunner.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2000-2015 by the Free Software Foundation, Inc.
+# Copyright (C) 2000-2016 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
@@ -12,7 +12,8 @@
#
# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
"""NNTP queue runner."""
@@ -109,7 +110,11 @@ def prepare_message(mlist, msg, msgdata):
or msgdata.get('origsubj')
if not mlist.news_prefix_subject_too and stripped_subject is not None:
del msg['subject']
- msg['subject'] = stripped_subject
+ msg['Subject'] = stripped_subject
+ # Make sure we have a non-blank subject.
+ if not msg.get('subject', '').strip():
+ del msg['subject']
+ msg['Subject'] = '(no subject)'
# Add the appropriate Newsgroups: header
if msg['newsgroups'] is not None:
# This message is gated from our list to it's associated usnet group.
@@ -125,6 +130,9 @@ def prepare_message(mlist, msg, msgdata):
# isn't ours with one of ours, so we need to parse it to be sure we're not
# looping.
#
+ # We also add the original Message-ID: to References: to try to help with
+ # threading issues and create another header for documentation.
+ #
# Our Message-ID format is <mailman.secs.pid.listname@hostname>
msgid = msg['message-id']
hackmsgid = True
@@ -137,6 +145,18 @@ def prepare_message(mlist, msg, msgdata):
if hackmsgid:
del msg['message-id']
msg['Message-ID'] = Utils.unique_message_id(mlist)
+ if msgid:
+ msg['X-Mailman-Original-Message-ID'] = msgid
+ refs = msg['references']
+ del msg['references']
+ if not refs:
+ refs = msg.get('in-reply-to', '')
+ else:
+ msg['X-Mailman-Original-References'] = refs
+ if refs:
+ msg['References'] = '\n '.join([refs, msgid])
+ else:
+ msg['References'] = msgid
# Lines: is useful
if msg['Lines'] is None:
# BAW: is there a better way?