[Mailman-Developers] simple feature
Barry A. Warsaw
barry@zope.com
Fri, 4 Jan 2002 02:25:37 -0500
>>>>> "BB" == Bill Bradford <mrbill@mrbill.net> writes:
BB> Will 2.1 have the ability to just completey *drop* posts
BB> matching a pattern, instead of holding them for moderation?
BB> I've got a couple of lists where Re: posts (replies back to
BB> the list) arent allowed; only initial problem messages and
BB> then a summary/solution posting.
General matching against headers with auto-discards probably will not
be supported out of the box in MM2.1.
BB> It would be nice if I could have Mailman just *drop* the Re:
BB> posts instead of holding them for moderation; I'd like to
BB> avoid having to use Procmail for this...
No need to use Procmail to add this feature though! Simply add a
pipeline module that checks the listname, and for those lists that you
want to discard Re: messages, simply search Subject: headers for Re:.
Here's some untested code that might get you close. Note that you'll
have to add this module to the GLOBAL_PIPELINE, probably just before
Hold.py.
-Barry
------------------- snip snip --------------------Mailman/Handlers/DiscardRe.py
import re
from Mailman.Errors import DiscardMessage
# If a list is not mentioned here, we don't even search its Subject:
LISTNAMES = [
'norelist1',
'norelist2',
# ...
]
# Compiled regular expression that searches for a literal string "Re:"
# matching case insensitively.
cre = re.compile(r're:', re.IGNORECASE)
def process(mlist, msg, msgdata):
if mlist.internal_name() not in LISTNAMES:
return
subject = msg['subject']
if subject and cre.search(subject):
raise DiscardMessage
-------------------- snip snip --------------------