From 72cc954c9284d1d0f77b31aa4d58fe2b732983eb Mon Sep 17 00:00:00 2001 From: dms Date: Sat, 17 Feb 2001 13:40:38 +0000 Subject: [PATCH] - added first time run checks. - on/off-line time stats - on_join ban now kicks with custom reason. git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@399 c11ca15a-4712-0410-83d8-924469b57eb5 --- src/IRC/IrcHooks.pl | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/IRC/IrcHooks.pl b/src/IRC/IrcHooks.pl index db75aa5..0dc9612 100644 --- a/src/IRC/IrcHooks.pl +++ b/src/IRC/IrcHooks.pl @@ -133,6 +133,20 @@ sub on_endofmotd { # update IRCStats. $ircstats{'ConnectTime'} = time(); $ircstats{'ConnectCount'}++; + $ircstats{'OffTime'} += time() - $ircstats{'DisconnectTime'} + if (defined $ircstats{'DisconnectTime'}); + + # first time run. + if (!exists $users{_default}) { + &status("First time run... adding _default user."); + $users{_default}{FLAGS} = "mrt"; + $users{_default}{HOSTS} = "*!*@*"; + } + + if (scalar keys %users < 2) { + &status("Ok... now /msg $ident PASS to get master access through DCC CHAT."); + } + # end of first time run. if (&IsChanConf("wingate")) { my $file = "$bot_base_dir/$param{'ircUser'}.wingate"; @@ -301,6 +315,7 @@ sub on_disconnect { $ircstats{'DisconnectTime'} = time(); $ircstats{'DisconnectReason'} = $what; $ircstats{'DisconnectCount'}++; + $ircstats{'TotalTime'} += time() - $ircstats{'ConnectTime'}; # clear any variables on reconnection. $nickserv = 0; @@ -440,16 +455,13 @@ sub on_join { my $reason = "no reason"; foreach ($chan, "*") { next unless (exists $bans{$_}); - next unless (exists $bans{$_}{$mask}); + next unless (exists $bans{$_}{$ban}); - my @array = @{ $bans{$_}{$mask} }; - foreach (@array) { - &DEBUG("on_join: ban: array => '$_'"); - } - $reason ||= $array[4]; + my @array = @{ $bans{$_}{$ban} }; + + $reason = $array[4] if ($array[4]); last; } - &DEBUG("on_join: ban: reason => '$reason'."); &ban($ban, $chan); &kick($who, $chan, $reason); -- 2.39.2