diff options
author | jimpop@template.hostname <> | 2015-11-04 21:09:42 +0000 |
---|---|---|
committer | jimpop@template.hostname <> | 2015-11-04 21:09:42 +0000 |
commit | 6bd19f91b98517af02a3dae766d49c1610967815 (patch) | |
tree | 901bfb1bc108065bda4fb0f8931274c1124edd62 /Mailman/Utils.py | |
parent | 2b8a93aad055efe7754ee3f1c93afd588b1d53ff (diff) | |
download | mailman2-6bd19f91b98517af02a3dae766d49c1610967815.tar.gz mailman2-6bd19f91b98517af02a3dae766d49c1610967815.tar.xz mailman2-6bd19f91b98517af02a3dae766d49c1610967815.zip |
Auto-Moderate Verbose Members
Diffstat (limited to '')
-rw-r--r-- | Mailman/Utils.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Mailman/Utils.py b/Mailman/Utils.py index f22e45b4..516514ac 100644 --- a/Mailman/Utils.py +++ b/Mailman/Utils.py @@ -1246,6 +1246,32 @@ def IsDMARCProhibited(mlist, email): return False +# Check a known list in order to auto-moderate verbose members +recentMemberPostings = {}; +def IsVerboseMember(mlist, email): + + threshold = 5 if mlist.member_verbosity_threshold is None else mlist.member_verbosity_threshold + if 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) + + syslog('vette', 'DEBUG: %s: Appended %f to recentMemberPostings[%s] (%d).', + mlist.real_name, t, email, len(recentMemberPostings[email])) + + for t in recentMemberPostings[email]: + if t < time.time() - float(interval): + recentMemberPostings[email].remove(t) + syslog('vette', 'DEBUG: %s: Removed %f from recentMemberPostings[%s] (%d).', + mlist.real_name, t, email, len(recentMemberPostings[email])) + + return len(recentMemberPostings[email]) >= threshold + + def check_eq_domains(email, domains_list): """The arguments are an email address and a string representing a list of lists in a form like 'a,b,c;1,2' representing [['a', 'b', |