#
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.
&quit($param{'quitMsg'}) if (&whatInterface() =~ /IRC/);
&writeUserFile();
&writeChanFile();
- &uptimeWriteFile() if (&IsParam("uptime"));
+ &uptimeWriteFile() if (&ChanConfList("uptime"));
&closeDB();
&closeSHM($shm);
&dumpallvars() if (&IsParam("dumpvarsAtExit"));
# 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;
}
}
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;
}
$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)");
}
}
&status($str);
- &DCCBroadcast($str) if (&whatInterface() =~ /IRC/ &&
- grep(/Irc.pl/, keys %moduleAge));
}
$memusageOld = $memusage;
} else {
# read.
&loadLang($bot_misc_dir. "/blootbot.lang");
- &loadIRCServers($bot_misc_dir. "/ircII.servers");
+ &loadIRCServers();
&readUserFile();
&readChanFile();
&loadMyModulesNow(); # must be after chan file.
$count{'Question'} = 0;
$count{'Update'} = 0;
$count{'Dunno'} = 0;
+ $count{'Moron'} = 0;
}
sub shutdown {
sub restart {
my ($sig) = @_;
- &DEBUG(" forked => ".scalar(keys %forked) );
- &DEBUG(" pid => ".scalar(keys %pid) );
-
if ($$ == $bot_pid) {
&status("--- $sig called.");
return;
}
+ &DCCBroadcast("-HUP called.","m");
&shutdown();
&loadConfig($bot_misc_dir."/blootbot.config");
&reloadAllModules() if (&IsParam("DEBUG"));