wally fatboy klingon
Fight ePatents in Europe!
Get FireFox
I'm a hacker!
Valid CSS!
Valid HTML 4.01!
 
This is my own chanlimit.pl script. It sets the channel limit (+l) for the channels specified to a value that people can join, but join-floods will fail. It doesn't detect join floods, but it can help prevent them. It saved me a few times already.

You can download the source from this link

The source is as follows:

#!/usr/bin/perl -w
#
# chanlimit
#
# Sets the channelmode +l to limit the ammount of people that are allowed
# to join to a reasonable (configurable!) value. It then checks every
# $configurable_interval seconds if it needs to change the limit.
#
# Settings:
#
#   limit_debug       bool    set to ON to see what the script decides.
#   
#   limit_channels    str     set to a comma separated list of channelnames
#                             including the # or ! chars, but NO SPACES
#                             
#   limit_time        int     set to the interval the script should check
#                             the channellimits. Value is in seconds.
#                             Changing this value isn't immediate. When the
#                             next check is done, this value is updated.
#                             
#   limit_offset      int     This number of people are allowed to join on
#                             top of the already joined people.
#                             
#   limit_grace       int     This number of people need to join or part
#                             to have the limit updated. Setting this to '1'
#                             will cause the limit to be updated after every
#                             join or part.
#

use Irssi;
use Irssi::Irc;

$VERSION = "1.0";
%IRSSI = (
    authors     => 'Sander Smeenk',
    contact     => 'scripts@freshdot.net',
    name        => 'chanlimit',
    description => 'Automatically sets user limits on channels to prevent joinfloods.',
    license     => 'GNU GPLv2 or later',
    url         => 'http://www.freshdot.net/irssi.shtml',
);

# This must be here first, or irssi will not recognise limit_time below
Irssi::settings_add_bool("chanlimit", "limit_debug", '0');
Irssi::settings_add_str("chanlimit", "limit_channels", '%s');
Irssi::settings_add_int("chanlimit", "limit_time", '90');
Irssi::settings_add_int("chanlimit", "limit_offset", '15');
Irssi::settings_add_int("chanlimit", "limit_grace", '10');

# First time installation of the timeout handler.
my $time        = Irssi::settings_get_int("limit_time") || 90;
my $timeout_tag = Irssi::timeout_add($time * 1000, 'chanlimit', '');

sub chanlimit {

	my $offset = Irssi::settings_get_int("limit_offset");
	my $grace  = Irssi::settings_get_int("limit_grace");
	my $debug  = Irssi::settings_get_bool("limit_debug");

	# Reset the timeout to user configured values.
	$time = Irssi::settings_get_int("limit_time") || 90;
	Irssi::timeout_remove($timeout_tag);
	$timeout_tag = Irssi::timeout_add($time * 1000, 'chanlimit', '');

	foreach my $channel (split /,/, Irssi::settings_get_str("limit_channels")) {
		my $c = Irssi::channel_find($channel);
		return unless ref $c; return unless $c->{chanop};
		my $numusers = scalar @{[$c->nicks]};

		Irssi::print("[limit] users: $numusers offset: $offset grace: $grace") if $debug;

		my $newlimit = $numusers + $offset;
		my $curlimit = ($c->{limit} || 0);
		Irssi::print("[limit] curlimit: $curlimit newlimit: $newlimit timeout: $time sec") if $debug;
		return if $newlimit == $curlimit;

		my $diff = 0;
		if ($newlimit > $curlimit) {
			$diff = $newlimit - $curlimit;
		} elsif ($curlimit > $newlimit) {
			$diff = $curlimit - $newlimit;
		}
	
		if (($diff >= $grace) || ($curlimit == 0)) {
			Irssi::print("[limit] diff: $diff -> update limit on $channel to ".($numusers+$offset)) if $debug;
			$c->{server}->send_raw("MODE $channel +l " . ($numusers+$offset));
		} else {
			Irssi::print("[limit] diff: $diff -> not updating limit (diff:$diff < grace:$grace)") if $debug;
		}
	}
}