[Mailman-Users] Limiting Number of Subscribers and Messages?

Jon Carnes jonc at nc.rr.com
Mon Apr 28 14:40:10 CEST 2003


On Mon, 2003-04-28 at 08:09, Victor Daniel the MacNut wrote:
> I've looked in the FAQ, and the archives, and the list owner pages, and have been unable to locate
> anything about this. So I'm asking here, is there a way to limit the number
> of subscribers that can join a Mailman list? Say, for example, I want one
> list to have only 20 subscribers, and another list to have no more than 500.
> And I'm able to change either of those numbers at any time.
> 
This is not a current feature of Mailman.  Of course it is Open Source
and I just can't stop myself from wonder, how would I build this in...

Take a look at the code from two of the scripts: add_members and
list_members.  Including the "list_members code into add_members, you
can easily calculate the number of current users of a list (assuming you
count all users - even "no mail" users).  Check this number before
allowing any adds to a list - drop an if statement in the code that says
if that number is greater than some value (a value that you could read
in from mm_cfg.py) then exit with a warning: Number of users of list
already exceeds %Max_val.

You would have to do the same for the Web-cgi, but since it already
calculates the number of users in the list, you can simply use this
number to direct the URL creation for the click (Mass subscribe users).

To be through, you would also need to add the check to the code for
adding users via email. 

Whew!  Sounds like a lot, but I'm guessing you could get it all done in
under 6 hours, if you just try.  If you're experienced with this kind of
thing ~ 2 hours.

> Another question I need to ask is, can the number of messages a Mailman list
> delivers be restricted? Say I want an announcement list to send only 1 message a week,
> and a discussion list to send no more than 10 messages a day. How do I do
> this?
> 
There may already be an existing patch for this (a few folks have asked
for it).  It's not a current feature of Mailman.

This would be an easy hack to the code.  You would simply create a file
in each lists' directory, and have that file increment a running total
for each message that goes through.  Put a hack in the code to moderate
"all" messages once that value is greater than some fixed number (read
out of mm_cfg.py).  You would put a script in cron that zero'ed the
files out at midnight (or 2am, whenever!).

The actual incrementing of the code can be either internal (more Mailman
hacks), or you could run a cron job which monitors the Mailman log files
and increments the number for each lists successful post.

Note, if you are a really good hacker, you would simply add this
incremented value to the lists' configuration file.

> Of course, the list owner should not be able to change the options for
> number of subscribers or messages per day. This should be the domain of the
> site admin only.
> 
> The MacNut 

Have fun MacNut!

Jon Carnes





More information about the Mailman-Users mailing list