> I would like HUP to re-read the chan/user files if the dates have
> changed, and write them if it has not. so you can:
>
> HUP
> edit
> HUP
- now possible.
git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk@769
c11ca15a-4712-0410-83d8-
924469b57eb5
return 0;
}
+sub isFileUpdated {
+ my ($file, $time) = @_;
+
+ if (! -f $file) {
+ return 1;
+ }
+
+ my $time_file = (stat $file)[9];
+
+ if ($time == $time_file) {
+ return 0;
+ } else {
+ return 1;
+ }
+}
+
##########
### make commands.
###
$ident ||= "blootbot"; # hack.
- if ($sig eq "HUP") {
- &status("::: not writing user/chan file w/ SIGHUP");
- } else {
- &writeUserFile();
+ if (!&isFileUpdated("$bot_state_dir/blootbot.users", $wtime_userfile)) {
+ &writeUserFile()
+ }
+
+ if (!&isFileUpdated("$bot_state_dir/blootbot.chan", $wtime_chanfile)) {
&writeChanFile();
}