summaryrefslogtreecommitdiffstats
path: root/scripts/autolimit.pl
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/autolimit.pl')
-rw-r--r--scripts/autolimit.pl31
1 files changed, 31 insertions, 0 deletions
diff --git a/scripts/autolimit.pl b/scripts/autolimit.pl
new file mode 100644
index 0000000..8989eed
--- /dev/null
+++ b/scripts/autolimit.pl
@@ -0,0 +1,31 @@
+use Irssi 20010920.0000 ();
+$VERSION = "1.00";
+%IRSSI = (
+ authors => 'David Leadbeater',
+ contact => 'dgl@dgl.cx',
+ name => 'autolimit',
+ description => 'does an autolimit for a channel, set variables in the script',
+ license => 'GNU GPLv2 or later',
+ url => 'http://irssi.dgl.yi.org/',
+);
+
+# Change these!
+my $channel = "#channel";
+my $offset = 5;
+my $tolerence = 2;
+my $time = 60;
+
+sub checklimit {
+ my $c = Irssi::channel_find($channel);
+ return unless ref $c;
+ return unless $c->{chanop};
+ my $users = scalar @{[$c->nicks]};
+
+ if(($c->{limit} <= ($users+$offset-$tolerence)) ||
+ ($c->{limit} > ($users+$offset+$tolerence))) {
+ $c->{server}->send_raw("MODE $channel +l " . ($users+$offset));
+ }
+}
+
+Irssi::timeout_add($time * 1000, 'checklimit','');
+