X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=src%2Fcore.pl;h=da909ce9b8741a754ecc615b9e9c8136e9eb0e12;hb=99f86352e2eff21f5eef65c16c41b44e1bfa17b6;hp=266890ecf4e4e9366661ff352185ff21563ae37b;hpb=857f3b7001b806dc469cb958d268f920a8017680;p=infobot.git diff --git a/src/core.pl b/src/core.pl index 266890e..da909ce 100644 --- a/src/core.pl +++ b/src/core.pl @@ -100,10 +100,10 @@ sub doExit { &status("--- Start of quit."); $ident ||= "blootbot"; # lame hack. - &closeDCC(); + &closeDCC() if (&whatInterface() =~ /IRC/); &closePID(); &closeStats(); - &seenFlush(); + &seenFlush() if (&whatInterface() =~ /IRC/); &quit($param{'quitMsg'}) if (&whatInterface() =~ /IRC/); &writeUserFile(); &writeChanFile(); @@ -303,6 +303,27 @@ sub getChanConf { return $chanconf{"_default"}{$param}; } +sub getChanConfDefault { + my($what, $default, $chan) = @_; + + if (exists $param{$what}) { + if (!exists $cache{config}{$what}) { + &status("conf: backward-compat: found param{$what} ($param{$what}) instead."); + $cache{config}{$what} = 1; + } + + return $param{$what}; + } + my $val = &getChanConf($what, $chan); + return $val if (defined $val); + + $param{$what} = $default; + &status("conf: auto-setting param{$what} = $default"); + $cache{config}{$what} = 1; + return $default; +} + + ##### # Usage: &findChanConf($param); # About: Retrieve value for 'param' value from any chan.