X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=src%2Fcore.pl;h=3c8a7d1f2a5b8bac0c2da2a64cef52677db3e7c8;hb=676a744c0752c02f747a8f61696d93a9aefe48cb;hp=a81c23f7f503044c5f0792339184300e91945972;hpb=531fdd472e245d7713bc5de22a476816ce3287fe;p=infobot.git diff --git a/src/core.pl b/src/core.pl index a81c23f..3c8a7d1 100644 --- a/src/core.pl +++ b/src/core.pl @@ -29,8 +29,8 @@ use vars qw(@joinchan @ircServers @wingateBad @wingateNow @wingateCache # use vars qw(%count %netsplit %netsplitservers %flood %dcc %orig %nuh %talkWho %seen %floodwarn %param %dbh %ircPort - %jointime %topic %joinverb %moduleAge %last %time %mask %file - %forked %pid %chanconf %channels + %topic %moduleAge %last %time %mask %file + %forked %chanconf %channels ); # Signals. @@ -85,7 +85,7 @@ sub doExit { &quit($param{'quitMsg'}) if (&whatInterface() =~ /IRC/); &writeUserFile(); &writeChanFile(); - &uptimeWriteFile() if (&IsParam("uptime")); + &uptimeWriteFile() if (&ChanConfList("uptime")); &closeDB(); &closeSHM($shm); &dumpallvars() if (&IsParam("dumpvarsAtExit")); @@ -128,14 +128,17 @@ sub IsParam { # Return: array of channels sub ChanConfList { my $param = $_[0]; + return unless (defined $param); my %chan = &getChanConfList($param); - return unless (defined $param); + # what if we have it set on _default and a few channels with + # negative set? perhaps we should disable -blah settings to remove + # this mess. - ### TODO: -option is included aswell though. - if ($chan{_default}) { - return keys %channels; + if (exists $chan{_default}) { + return keys %chanconf; } else { + ### TODO: -option is included aswell though. return keys %chan; } } @@ -197,10 +200,11 @@ sub IsChanConf { return $chan{_default} || 0; } - &DEBUG("param => $param, msgType => $msgType."); - foreach (keys %chan) { - &DEBUG(" $_ => $chan{$_}"); - } +### debug purposes only. +# &DEBUG("param => $param, msgType => $msgType."); +# foreach (keys %chan) { +# &DEBUG(" $_ => $chan{$_}"); +# } return 0; } @@ -220,7 +224,7 @@ sub getChanConf { $chan ||= "_default"; my @c = grep /^$chan$/i, keys %chanconf; - if ($c[0] ne $chan) { + if (@c and $c[0] ne $chan) { &WARN("c ne chan ($c[0] ne $chan)"); } @@ -258,8 +262,6 @@ sub showProc { } &status($str); - &DCCBroadcast($str) if (&whatInterface() =~ /IRC/ && - grep(/Irc.pl/, keys %moduleAge)); } $memusageOld = $memusage; } else { @@ -286,7 +288,7 @@ sub setup { # read. &loadLang($bot_misc_dir. "/blootbot.lang"); - &loadIRCServers($bot_misc_dir. "/ircII.servers"); + &loadIRCServers(); &readUserFile(); &readChanFile(); &loadMyModulesNow(); # must be after chan file. @@ -341,6 +343,7 @@ sub startup { $count{'Question'} = 0; $count{'Update'} = 0; $count{'Dunno'} = 0; + $count{'Moron'} = 0; } sub shutdown { @@ -355,9 +358,6 @@ sub shutdown { sub restart { my ($sig) = @_; - &DEBUG(" forked => ".scalar(keys %forked) ); - &DEBUG(" pid => ".scalar(keys %pid) ); - if ($$ == $bot_pid) { &status("--- $sig called."); @@ -369,6 +369,7 @@ sub restart { return; } + &DCCBroadcast("-HUP called.","m"); &shutdown(); &loadConfig($bot_misc_dir."/blootbot.config"); &reloadAllModules() if (&IsParam("DEBUG"));