X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=src%2Fcore.pl;h=c8696653f0f3c18af99c80e5310a26a20bea695c;hb=34a4d11667b0a734343f82d2adbaac23f738ad18;hp=36e8c76b66eca42a3d37072b62892305937abd22;hpb=9514f09ee10a2cd694755466c813994e09ec3a40;p=infobot.git diff --git a/src/core.pl b/src/core.pl index 36e8c76..c869665 100644 --- a/src/core.pl +++ b/src/core.pl @@ -99,6 +99,7 @@ sub doExit { &closeDCC(); &closePID(); + &closeStats(); &seenFlush(); &quit($param{'quitMsg'}) if (&whatInterface() =~ /IRC/); &writeUserFile(); @@ -201,6 +202,8 @@ sub IsChanConf { return 0; } + $chan ||= "_default"; + my $old = $chan; if ($chan =~ tr/A-Z/a-z/) { &WARN("IsChanConf: lowercased chan. ($old)"); @@ -282,6 +285,7 @@ sub getChanConf { $c ||= $chan; $c ||= "_default"; + $c = "_default" if ($c eq "*"); # fix! my @c = grep /^$c$/i, keys %chanconf; if (@c) { @@ -295,6 +299,31 @@ sub getChanConf { return $chanconf{"_default"}{$param}; } +##### +# Usage: &findChanConf($param); +# About: Retrieve value for 'param' value from any chan. +# Return: scalar for success, undef for failure. +sub findChanConf { + my($param) = @_; + + if (!defined $param) { + &WARN("param == NULL."); + return 0; + } + + my $c; + foreach $c (keys %chanconf) { + foreach (keys %{ $chanconf{$c} }) { + next unless (/^$param$/); + + &DEBUG("chanconf{$c}{$_} ..."); + return $chanconf{$c}{$_}; + } + } + + return; +} + sub showProc { my ($prefix) = $_[0] || ""; @@ -452,8 +481,9 @@ sub restart { ### crappy bug in Net::IRC? if (!$conn->connected and time - $msgtime > 900) { - &status("reconnecting because of uncaught disconnect."); + &status("reconnecting because of uncaught disconnect \@ ".scalar(localtime) ); ### $irc->start; + &clearIRCVars(); $conn->connect(); ### return; }