summaryrefslogtreecommitdiff
path: root/Mailman/Handlers/Moderate.py
diff options
context:
space:
mode:
authorbwarsaw2002-01-21 15:48:55 +0000
committerbwarsaw2002-01-21 15:48:55 +0000
commit753a0e8dd5381e63b1ae4305c6bd84601ac1ee4b (patch)
tree29978409fa8902a55e06a560db71d790b55c176f /Mailman/Handlers/Moderate.py
parent6513e7096a1cd10c11bec159034263977e2a81fa (diff)
downloadmailman-753a0e8dd5381e63b1ae4305c6bd84601ac1ee4b.tar.gz
mailman-753a0e8dd5381e63b1ae4305c6bd84601ac1ee4b.tar.zst
mailman-753a0e8dd5381e63b1ae4305c6bd84601ac1ee4b.zip
Some elaboration of the member moderation flag semantics. Now it's
possible to assign an action to the flag, which ought to work better for e.g. announce-only lists. Specifically, process(): If we're looking at a member and that member has their moderation flag turned on, then we look at mlist.member_moderation_action. This is a 3-way selector specifying whether the message should be held for approval, rejected (bounced), or discarded. There's also a member_moderation_notice attribute which includes text to send back to the member when their posting is automatically rejected (WIBNI we could include that text in any held or discard notification? Too much code disruption to do that right now).
Diffstat (limited to 'Mailman/Handlers/Moderate.py')
-rw-r--r--Mailman/Handlers/Moderate.py27
1 files changed, 25 insertions, 2 deletions
diff --git a/Mailman/Handlers/Moderate.py b/Mailman/Handlers/Moderate.py
index 7231c1654..de19e3c5d 100644
--- a/Mailman/Handlers/Moderate.py
+++ b/Mailman/Handlers/Moderate.py
@@ -27,6 +27,7 @@ from Mailman import Message
from Mailman import Errors
from Mailman.i18n import _
from Mailman.Handlers import Hold
+from Mailman.Logging.Syslog import syslog
@@ -41,9 +42,31 @@ def process(mlist, msg, msgdata):
# First of all, is the poster a member or not?
sender = msg.get_sender()
if mlist.isMember(sender):
- # If the member's moderation flag is on, then hold for approval.
+ # If the member's moderation flag is on, then perform the moderation
+ # action.
if mlist.getMemberOption(sender, mm_cfg.Moderate):
- Hold.hold_for_approval(mlist, msg, msgdata, ModeratedMemberPost)
+ # Note that for member_moderation_action, 0==Hold, 1=Reject,
+ # 2==Discard
+ if mlist.member_moderation_action == 0:
+ # Hold. BAW: WIBNI we could add the member_moderation_notice
+ # to the notice sent back to the sender?
+ Hold.hold_for_approval(mlist, msg, msgdata,
+ ModeratedMemberPost)
+ elif mlist.member_moderation_action == 1:
+ # Reject
+ text = mlist.member_moderation_notice
+ if text:
+ text = Utils.wrap(text)
+ else:
+ # Use the default RejectMessage notice string
+ text = None
+ raise Errors.RejectMessage, text
+ elif mlist.member_moderation_action == 2:
+ # Discard. BAW: Again, it would be nice if we could send a
+ # discard notice to the sender
+ raise Errors.DiscardMessage
+ else:
+ assert 0, 'bad member_moderation_action'
# Should we do anything explict to mark this message as getting past
# this point? No, because further pipeline handlers will need to do
# their own thing.