Skip to Content.
Sympa Menu

en - RE: [sympa-users] limit number of user posts

Subject: The mailing list for listmasters using Sympa

List archive

Chronological Thread  
  • From: Steve Shipway <address@concealed>
  • To: "Ed C." <address@concealed>, "address@concealed" <address@concealed>
  • Subject: RE: [sympa-users] limit number of user posts
  • Date: Fri, 11 Jan 2013 03:05:45 +0000

> When our mailing list was on LISTSERV the moderator/owner could limit
> daily posts per user and also for the whole group. I think it was set
> at
> (8 per user and 60 total). Is there some scenario that could be written
> by a list owner for Sympa to accomplish the same thing?

This sounds a good idea. Not so simple, though -- maybe a feature request
for Sympa?

To implement this now (without modifying the Sympa code) I think you'd need
to -

1. create a database table to hold
robot/listname/subscriber/lastpostdate/postcount keyed on
robot/listname/subscriber
2. create a custom scenario function in CustomCondition namespace (eg:
CustomCondition::postlimit) to update this table; returning false if
postcount>param. I'm not sure if it could utilise any global functions or
database connections in the existing Sympa module for database access; this
would be preferable I think.
Heres a start on the sympa/custom_conditions/postlimit.pm module:
package CustomCondition::postlimit
use strict; use Log; use POSIX;
sub verify {
my($listname,$sender,$limit,$globallimit)=@_;
my($lastdate,$count,$globalcount,$today);
# get todays date
$today = strftime('%y-%m-%d',localtime());
# retrieve record from table or create new
($lastdate, $count,$globalcount) = ....
# reset count if lastdate!=today
if( $lastdate != $today ) { $lastdate = $today, $count = 0; }
# increment per-user count
$count += 1;
# update table
....
# test value
return 1 if($count <= $limit and $globalcount <= $globallimit);
do_log('info',"Too many posts for $sender to $listname ( $count > $limit
)" );
return 0;
}
1;
3. hook this in to your send scenario using something like:
CustomCondition::postlimit([listname],[sender],8,60) smtp,smime,md5 ->
do_it
true() smtp,smime,md5 ->
reject(reason="Too many posts today")

Completing the function will be more of a challenge though

Steve


Steve Shipway
ITS Unix Services Design Lead
University of Auckland, New Zealand
Floor 1, 58 Symonds Street, Auckland
Phone: +64 (0)9 3737599 ext 86487
DDI: +64 (0)9 924 6487
Mobile: +64 (0)21 753 189
Email: address@concealed
 Please consider the environment before printing this e-mail :
打印本邮件,将减少一棵树存活的机会


Attachment: smime.p7s
Description: S/MIME cryptographic signature




Archive powered by MHonArc 2.6.19+.

Top of Page