]> git.donarmstrong.com Git - infobot.git/blobdiff - src/core.pl
- berkeley dbm support now works! thanks to tim riker.
[infobot.git] / src / core.pl
index 266890ecf4e4e9366661ff352185ff21563ae37b..da909ce9b8741a754ecc615b9e9c8136e9eb0e12 100644 (file)
@@ -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.