[Mailman-Developers] [Patch] [long] Reply-To munging: stop the
madness
Joseph Knapka
jknapka at earthlink.net
Mon Apr 21 20:18:04 EDT 2003
And by "the madness", I mean the fact that I've seen more list traffic
devoted to reply-to munging in the past year than to any other single
subject. That's just silly; but Reply-To flamewars seem to break out
every three months or so on every list I'm subscribed to. It's a
tragic waste of bandwidth.
It seems to me that the obvious way to make everyone happy is to make
the presence of "Reply-To: list" headers a per-subscriber option. I
have implemented something simple that achieves this goal in a fairly
icky way; patch and explanation below. However, the main purpose of
this message is to suggest that in some future Mailman release,
"Reply-To: list" be a subscriber-centric option rather than a
list-centric one.
---
The patch below permits a list's accept_these_nonmembers attribute to
contain entries of the form "^+listname", which causes Mailman to
assume, for post-moderation purposes, that all subscribers to
"listname" are also subscribed to the list being managed. For example,
if list A's accept_these_nonmembers contains ^+B, then all
subscribers to B will be allowed to post to A. This permits the
following (suboptimal) solution to the Reply-To munging controversy:
For each list L for which L.reply_goes_to_list="This list", create
a second list L-no-reply-to with L-no-reply-to.reply_goes_to_list="Poster".
Add L-no-reply-to to L's subscriber list.
Add ^+L-no-reply-to to L.accept_these_nonmembers.
Add ^+L to L-no-reply-to.accept_these_nonmembers.
Now, anyone who doesn't want to get Reply-To headers subscribes to
L-no-reply-to instead of L. Everyone still posts to L, however, and
all traffic posted to L appears on both lists. Due to the ^+ options,
anyone subscribed to either list can post to L and have their posts
picked up by L-no-reply-to. (Of course, we could have allowed
nonsubscribers to post to both lists, but no one on the particular
list for which I produced these patches wanted to do that, due to spam
problems.)
This is obviously a less-than-perfect solution, which is why I'm
suggesting it be done differently in a future release. I'm willing
to look into implementing Reply-To as a subscriber option, but
I may not have time to do so.
Here are the patches, to GUIBase.py and Moderate.py. The patch
to GUIBase.py simply relaxes the input validation to allow
the ^+listname entries; the Moderate.py patch implements the
additional moderation logic.
===File /usr/local/mailman/GUIBase.py.diff==================
--- /usr/local/mailman/src/mailman-2.1.1/Mailman/Gui/GUIBase.py 2002-08-14 18:02:27.000000000 -0600
+++ GUIBase.py 2003-04-21 07:16:55.000000000 -0600
@@ -73,10 +73,11 @@
# See if this is a context that accepts regular
# expressions, and that the re is legal
if wtype == mm_cfg.EmailListEx and addr.startswith('^'):
- try:
- re.compile(addr)
- except re.error:
- raise ValueError
+ if not addr.startswith('^+'):
+ try:
+ re.compile(addr)
+ except re.error:
+ raise ValueError
else:
raise
addrs.append(addr)
============================================================
===File /usr/local/mailman/Moderate.py.diff=================
--- /usr/local/mailman/src/mailman-2.1.1/Mailman/Handlers/Moderate.py 2002-12-30 20:28:41.000000000 -0700
+++ Moderate.py 2003-04-21 09:43:18.000000000 -0600
@@ -16,7 +16,6 @@
"""Posting moderation filter.
"""
-
import re
from email.MIMEMessage import MIMEMessage
from email.MIMEText import MIMEText
@@ -28,6 +27,7 @@
from Mailman.i18n import _
from Mailman.Handlers import Hold
from Mailman.Logging.Syslog import syslog
+import Mailman.MailList
@@ -115,14 +115,27 @@
def matches_p(sender, nonmembers):
- # First strip out all the regular expressions
- plainaddrs = [addr for addr in nonmembers if not addr.startswith('^')]
+ # First do list inclusions.
+ incAdd = []
+ for linc in nonmembers:
+ if linc.startswith('^+'):
+ otherListName = linc[2:]
+ try:
+ otherList = Mailman.MailList.MailList(otherListName,lock=0)
+ otherMembers = otherList.getMembers()
+ incAdd = incAdd + otherMembers
+ except:
+ syslog.write("Moderator","Could not process list inclusion %s"%otherListName)
+ pass
+ nonmembers = nonmembers+incAdd
+ # Strip out all the regular expressions and list inclusions
+ plainaddrs = [addr for addr in nonmembers if not addr.startswith('^')]
addrdict = Utils.List2Dict(plainaddrs, foldcase=1)
if addrdict.has_key(sender):
return 1
# Now do the regular expression matches
for are in nonmembers:
- if are.startswith('^'):
+ if are.startswith('^') and not are.startswith('^+'):
try:
cre = re.compile(are, re.IGNORECASE)
except re.error:
============================================================
Cheers,
-- Joe Knapka
More information about the Mailman-Developers
mailing list