aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortkikuchi <>2005-02-12 14:31:45 +0000
committertkikuchi <>2005-02-12 14:31:45 +0000
commitccd53bc99e5aa7bf6cc2565f6dca8762351767ec (patch)
tree6acbf1bb1f27580746a8ea75e9c60bae8456f0b4
parent9aa489fc0a63970b5616085cb9d918a1431898ee (diff)
downloadmailman2-ccd53bc99e5aa7bf6cc2565f6dca8762351767ec.tar.gz
mailman2-ccd53bc99e5aa7bf6cc2565f6dca8762351767ec.tar.xz
mailman2-ccd53bc99e5aa7bf6cc2565f6dca8762351767ec.zip
Request from Brad Knowles. We need subject prefix stripped
from the posts from mailling list for gatewaying to nntp.
-rw-r--r--Mailman/Handlers/CookHeaders.py11
-rw-r--r--Mailman/Queue/NewsRunner.py11
2 files changed, 18 insertions, 4 deletions
diff --git a/Mailman/Handlers/CookHeaders.py b/Mailman/Handlers/CookHeaders.py
index c76fe498..fce88c44 100644
--- a/Mailman/Handlers/CookHeaders.py
+++ b/Mailman/Handlers/CookHeaders.py
@@ -300,8 +300,16 @@ def prefix_subject(mlist, msg, msgdata):
h = h.encode('us-ascii')
else:
h = unicode(h, 'us-ascii').encode('us-ascii')
+ h = uheader(mlist, h, 'Subject', continuation_ws=ws)
del msg['subject']
msg['Subject'] = h
+ ss = ' '.join([recolon, subject])
+ if _isunicode(ss):
+ ss = ss.encode('us-ascii')
+ else:
+ ss = unicode(ss, 'us-ascii').encode('us-ascii')
+ ss = uheader(mlist, ss, 'Subject', continuation_ws=ws)
+ msgdata['stripped_subject'] = ss
return
except UnicodeError:
pass
@@ -324,6 +332,9 @@ def prefix_subject(mlist, msg, msgdata):
h.append(subject, cset)
del msg['subject']
msg['Subject'] = h
+ ss = uheader(mlist, recolon, 'Subject', continuation_ws=ws)
+ ss.append(subject, cset)
+ msgdata['stripped_subject'] = ss
def ch_oneline(s):
diff --git a/Mailman/Queue/NewsRunner.py b/Mailman/Queue/NewsRunner.py
index 2b40a3ca..be1dd93d 100644
--- a/Mailman/Queue/NewsRunner.py
+++ b/Mailman/Queue/NewsRunner.py
@@ -102,11 +102,14 @@ def prepare_message(mlist, msg, msgdata):
del msg['approved']
msg['Approved'] = mlist.GetListEmail()
# Should we restore the original, non-prefixed subject for gatewayed
- # messages?
- origsubj = msgdata.get('origsubj')
- if not mlist.news_prefix_subject_too and origsubj is not None:
+ # messages? TK: We use stripped_subject (prefix stripped) which was
+ # crafted in CookHeaders.py to ensure prefix was stripped from the subject
+ # came from mailing list user.
+ stripped_subject = msgdata.get('stripped_subject') \
+ or msgdaga.get('origsubj')
+ if not mlist.news_prefix_subject_too and stripped_subject is not None:
del msg['subject']
- msg['subject'] = origsubj
+ msg['subject'] = stripped_subject
# Add the appropriate Newsgroups: header
ngheader = msg['newsgroups']
if ngheader is not None: