diff options
author | jimpop@template.hostname <> | 2015-11-04 22:49:05 +0000 |
---|---|---|
committer | jimpop@template.hostname <> | 2015-11-04 22:49:05 +0000 |
commit | b8811f8fc2d9bd27d1963c000ddaf05d951b5bda (patch) | |
tree | b3447d4398422a86c259280b86f3f3e2b7c2b973 | |
parent | a777ae450ed966ca75f22c140fee938c5fd37996 (diff) | |
download | mailman2-b8811f8fc2d9bd27d1963c000ddaf05d951b5bda.tar.gz mailman2-b8811f8fc2d9bd27d1963c000ddaf05d951b5bda.tar.xz mailman2-b8811f8fc2d9bd27d1963c000ddaf05d951b5bda.zip |
Improvements based on feedback from Mark Sapiro
https://code.launchpad.net/~jimpop/mailman/mailman-auto-mod-verbose-members/+merge/276706/comments/699744
Diffstat (limited to '')
-rwxr-xr-x | Mailman/Defaults.py.in | 2 | ||||
-rw-r--r-- | Mailman/Handlers/SpamDetect.py | 2 | ||||
-rw-r--r-- | Mailman/Utils.py | 8 | ||||
-rwxr-xr-x | Mailman/versions.py | 3 |
4 files changed, 7 insertions, 8 deletions
diff --git a/Mailman/Defaults.py.in b/Mailman/Defaults.py.in index 093ce1c8..80d8694c 100755 --- a/Mailman/Defaults.py.in +++ b/Mailman/Defaults.py.in @@ -1122,7 +1122,7 @@ DMARC_RESOLVER_LIFETIME = seconds(5) # DEFAULT_MEMBER_VERBOSITY_INTERVAL = number of seconds to track posts # DEFAULT_MEMBER_VERBOSITY_THRESHOLD = number of allowed posts per interval (0 to disable). DEFAULT_MEMBER_VERBOSITY_INTERVAL = 300 -DEFAULT_MEMBER_VERBOSITY_THRESHOLD = 5 +DEFAULT_MEMBER_VERBOSITY_THRESHOLD = 0 # What domains should be considered equivalent when testing list membership # for posting/moderation. diff --git a/Mailman/Handlers/SpamDetect.py b/Mailman/Handlers/SpamDetect.py index 6c10bb65..509e1e6e 100644 --- a/Mailman/Handlers/SpamDetect.py +++ b/Mailman/Handlers/SpamDetect.py @@ -123,7 +123,7 @@ error, contact the mailing list owner at %(listowner)s.""")) elif mlist.dmarc_moderation_action == 4: raise Errors.DiscardMessage - if Utils.IsVerboseMember(mlist, addr): + if mlist.member_verbosity_threshold > 0 and Utils.IsVerboseMember(mlist, addr): mlist.setMemberOption(addr, mm_cfg.Moderate, 1) syslog('vette', '%s: Automatically Moderated %s for verbose postings.', mlist.real_name, addr) diff --git a/Mailman/Utils.py b/Mailman/Utils.py index a4eb05da..70ef34e8 100644 --- a/Mailman/Utils.py +++ b/Mailman/Utils.py @@ -1250,21 +1250,19 @@ def IsDMARCProhibited(mlist, email): recentMemberPostings = {}; def IsVerboseMember(mlist, email): - threshold = 5 if mlist.member_verbosity_threshold is None else mlist.member_verbosity_threshold - if threshold == 0: + if mlist.member_verbosity_threshold == 0: return False - interval = 5 if mlist.member_verbosity_interval is None else mlist.member_verbosity_interval email = email.lower() t = time.time() recentMemberPostings.setdefault(email,[]).append(t) for t in recentMemberPostings[email]: - if t < time.time() - float(interval): + if t < time.time() - float(mlist.member_verbosity_interval): recentMemberPostings[email].remove(t) - return len(recentMemberPostings[email]) >= threshold + return len(recentMemberPostings[email]) >= mlist.member_verbosity_threshold def check_eq_domains(email, domains_list): diff --git a/Mailman/versions.py b/Mailman/versions.py index d1f06543..d13be94f 100755 --- a/Mailman/versions.py +++ b/Mailman/versions.py @@ -497,7 +497,8 @@ def NewVars(l): add_only_if_missing('dmarc_moderation_notice', '') add_only_if_missing('dmarc_wrapped_message_text', mm_cfg.DEFAULT_DMARC_WRAPPED_MESSAGE_TEXT) - add_only_if_missing('member_verbosity_threshold', 0) + add_only_if_missing('member_verbosity_threshold', + mm_cfg.DEFAULT_MEMBER_VERBOSITY_THRESHOLD) add_only_if_missing('member_verbosity_interval', mm_cfg.DEFAULT_MEMBER_VERBOSITY_INTERVAL) add_only_if_missing('equivalent_domains', |