[Mailman-Developers] Mail-to-news gatewaying?
Brad Knowles
brad at stop.mail-abuse.org
Tue Feb 8 02:30:00 CET 2005
Folks,
Okay, so we know about the issue of munging Message-ID: (if you
don't know what I'm talking about, see
<http://www.python.org/cgi-bin/faqw-mm.py?req=show&file=faq04.059.htp>).
The latest crisis that has me wondering is the subject prefix
stuff. Looking in NewsRunner.py, starting at line 104, we have:
# 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:
del msg['subject']
msg['subject'] = origsubj
However, we still have a problem. If mail clients reply to the
message to the list (which will include the subject prefix), then
this will result in a new message with a subject prefix for the list
already present. Now, Mailman is smart and avoids adding a second
subject prefix, but it doesn't strip out the subject prefix if one
already exists. For the mailing list, this subject prefix stripping
isn't necessary. But for gatewaying to the newsgroup, it might be
desirable.
This would also resolve the issue of restoring the original
subject when gatewaying -- don't bother, and just let the subject
prefix stripper deal with it.
If this were sed or Perl, I could quickly put together a one-line
hack to implement this feature. For example, just doing something
off the top of my head, you might be able to use something like:
subject=y/\w*$prefix\w*/ /;
But this is Python, and I don't really grok Python. Can someone
help me out here?
Looking at
<http://www.python.org/doc/2.3.4/lib/module-string.html>, I'm
imagining some sort of permutation of find(), split(), either
lstrip() or rstrip(), and then join(), should be sufficient to do the
job. But I'm not quite able to figure out how to put them all
together.
Of course, the reason why I ask is that I'm getting complaints
about the mail-to-news gateway I'm running at another site, and I
don't want this to blow up into an ugly situation.
Sigh....
--
Brad Knowles, <brad at stop.mail-abuse.org>
"Those who would give up essential Liberty, to purchase a little
temporary Safety, deserve neither Liberty nor Safety."
-- Benjamin Franklin (1706-1790), reply of the Pennsylvania
Assembly to the Governor, November 11, 1755
SAGE member since 1995. See <http://www.sage.org/> for more info.
More information about the Mailman-Developers
mailing list