summaryrefslogtreecommitdiffstats
path: root/modules/event.pl
diff options
context:
space:
mode:
authorLibravatarWilliam Heimbigner <william.heimbigner@gmail.com>2007-10-08 13:28:23 +0000
committerLibravatarWilliam Heimbigner <william.heimbigner@gmail.com>2007-10-08 13:28:23 +0000
commit917638dfdf31e26ae9115dabb5c2fe528866c549 (patch)
treed5ab13c057983bff1fac0ed64638bb105f8f03b7 /modules/event.pl
parent3790452619828dc2c5d27c13eeec7b67b3fe6eff (diff)
added a db command, improved the user set flags command, added linked channels, added a showhilights command, eliminated flooding of alerts, fixed nickspam check, added something to watch chancounts.
Diffstat (limited to 'modules/event.pl')
-rw-r--r--modules/event.pl37
1 files changed, 20 insertions, 17 deletions
diff --git a/modules/event.pl b/modules/event.pl
index e7b3a66..c77fda1 100644
--- a/modules/event.pl
+++ b/modules/event.pl
@@ -67,8 +67,6 @@ sub on_connect {
$conn->privmsg( 'NickServ', "ghost $::settings->{nick} $::settings->{pass}" ) if lc $event->{args}->[0] ne lc $::settings->{nick};
}
-#my @leven = ();
-
sub on_join {
my ($conn, $event) = @_;
my %evcopyx = %{$event};
@@ -80,6 +78,11 @@ sub on_join {
mkdir($::settings->{log}->{dir} . $chan);
$conn->sl("who $chan");
$conn->privmsg('ChanServ', "op $chan" ) if (defined cs($chan)->{op}) && (cs($chan)->{op} eq 'yes');
+ #TODO: make it settable via config. Hardcoded channames ftl.
+ if ($chan eq '##linux') {
+ $conn->schedule(300, \&do_chancount, $chan, 300);
+ #TODO: mark this as a channel we're watching so we don't schedule this multiple times
+ }
}
$::sc{$chan}{users}{$nick} = {};
$::sc{$chan}{users}{$nick}{hostmask} = $event->{userhost};
@@ -104,21 +107,6 @@ sub on_join {
}
}
$::log->logg( $event );
-# if ( $#leven ne -1 ) {
-# my $ld = ( ( maxlen($nick, $leven[0]) - distance($nick, $leven[0]) ) / maxlen($nick, $leven[0]) );
-# my $mx = $leven[0];
-# foreach my $item ( @leven ) {
-# next if $nick eq $item; # avoid dups
-# my $tld = ( ( maxlen($nick, $item) - distance($nick, $item) ) / maxlen($nick, $item) );
-# if ($tld > $ld) {
-# $ld = $tld;
-# $mx = $item;
-# }
-# }
-# print "Best match for $nick was $mx with $ld\n"
-# }
-# push(@leven, $nick);
-# shift @leven if $#leven > 5;
}
sub on_part
@@ -139,6 +127,7 @@ sub on_part
if ( lc $conn->{_nick} eq lc $nick )
{
delete( $::sc{lc $event->{to}->[0]} );
+ on_byechan(lc $event->{to}->[0]);
}
else
{
@@ -278,6 +267,7 @@ sub on_kick {
if ( lc $conn->{_nick} eq lc $nick )
{
delete( $::sc{lc $event->{args}->[0]} );
+ on_byechan(lc $event->{to}->[0]);
}
else
{
@@ -431,4 +421,17 @@ sub on_bannedfromchan {
$conn->privmsg('ChanServ', "unban $event->{args}->[1]");
}
+sub on_byechan {
+ my ($chan) = @_;
+ #TODO do del event stuff
+}
+
+sub do_chancount {
+ my ($conn, $chan, $repeat) = @_;
+ my @users = keys(%{$::sc{$chan}{users}});
+ my $count = @users;
+ system('/home/icxcnika/AntiSpamMeta/chancount.pl ' . $chan . sprintf(' %d', $count));
+ $conn->schedule($repeat, \&do_chancount, $chan, $repeat);
+}
+
return 1;