From: dms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Date: Sun, 23 Feb 2003 12:45:10 +0000 (+0000)
Subject: - killall -HUP now doesn't write then read the user/chan file.
X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=8c27016c02c1aa6dc4c268c44f8530311afe1d32;p=infobot.git

- killall -HUP now doesn't write then read the user/chan file.
  good for modifying the config files by hand.


git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@767 c11ca15a-4712-0410-83d8-924469b57eb5
---

diff --git a/src/core.pl b/src/core.pl
index dbdc509..4c5d0e7 100644
--- a/src/core.pl
+++ b/src/core.pl
@@ -321,7 +321,7 @@ sub getChanConfDefault {
 
     if (exists $param{$what}) {
 	if (!exists $cache{config}{$what}) {
-	    &status("conf: backward-compat: found param{$what} ($param{$what}) for $chan instead.");
+	    &status("Config ($chan): backward-compatible option: found param{$what} ($param{$what}) instead");
 	    $cache{config}{$what} = 1;
 	}
 
@@ -331,7 +331,7 @@ sub getChanConfDefault {
     return $val if (defined $val);
 
     $param{$what}	= $default;
-    &status("conf: $chan auto-setting param{$what} = $default");
+    &status("Config ($chan): auto-setting param{$what} = $default");
     $cache{config}{$what} = 1;
     return $default;
 }
@@ -487,15 +487,18 @@ sub startup {
 }
 
 sub shutdown {
+    my ($sig) = @_;
     # reverse order of &setup().
     &status("--- shutdown called.");
 
     $ident ||=	"blootbot";	# hack.
 
-    # opened files must be written to on shutdown/hup/whatever
-    # unless they're write-only, like uptime.
-    &writeUserFile();
-    &writeChanFile();
+    if ($sig eq "HUP") {
+	&status("::: not writing user/chan file w/ SIGHUP");
+    } else {
+	&writeUserFile();
+	&writeChanFile();
+    }
 
     &sqlCloseDB();
     &closeSHM($shm);	# aswell. TODO: use this in &doExit?
@@ -522,7 +525,7 @@ sub restart {
 	&ircCheck();	# heh, evil!
 
 	&DCCBroadcast("-HUP called.","m");
-	&shutdown();
+	&shutdown($sig);
 	&loadConfig($bot_config_dir."/blootbot.config");
 	&reloadAllModules() if (&IsParam("DEBUG"));
 	&setup();