# dynamic scalar. MUST BE REDUCED IN SIZE!!!
### TODO: reorder.
use vars qw(
- $answer $correction_plausible $loggingstatus $talkchannel
+ $answer $correction_plausible $talkchannel
$statcount $memusage $user $memusageOld $bot_version $dbh
$shm $host $msg $bot_misc_dir $bot_pid $bot_base_dir $noreply
$bot_src_dir $conn $irc $learnok $nick $ident $no_syscall
$firsttime = 1;
### CHANGE TO STATIC.
-$bot_version = "blootbot 1.0.0 (20000725) -- $^O";
-$noreply = "NOREPLY";
+$bot_version = "blootbot 1.0.3 (20000930) -- $^O";
+$noreply = "NOREPLY";
##########
### misc commands.
&closeSHM($shm);
&dumpallvars() if (&IsParam("dumpvarsAtExit"));
&closeLog();
+ &closeSQLDebug() if (&IsParam("SQLDebug"));
} else { # child.
&status("child caught SIG$sig (pid $$).");
}
if (defined $memusageOld and &IsParam("DEBUG")) {
# it's always going to be increase.
my $delta = $memusage - $memusageOld;
- if ($delta > 500) {
- &status("MEM:$prefix increased by $delta kB. (total: $memusage kB)");
+ my $str;
+ if ($delta == 0) {
+ return;
+ } elsif ($delta > 500) {
+ $str = "MEM:$prefix increased by $delta kB. (total: $memusage kB)";
} elsif ($delta > 0) {
- &status("MEM:$prefix increased by $delta kB.");
- } elsif ($delta < 0) {
+ $str = "MEM:$prefix increased by $delta kB";
+ } else { # delta < 0.
$delta = -$delta;
# never knew RSS could decrease, probably Size can't?
- &status("MEM:$prefix decreased by $delta kB. YES YES YES");
+ $str = "MEM:$prefix decreased by $delta kB. YES YES YES";
}
+
+ &status($str);
+ &DCCBroadcast($str) if (&whatInterface() =~ /IRC/ &&
+ grep(/Irc.pl/, keys %moduleAge));
}
$memusageOld = $memusage;
} else {
&showProc(" (\&openLog before)");
&openLog(); # write, append.
+ foreach ("debian") {
+ my $dir = "$bot_base_dir/$_/";
+ next if ( -d $dir);
+ &status("Making dir $_");
+ mkdir $dir, 0755;
+ }
+
# read.
&loadIgnore($bot_misc_dir. "/blootbot.ignore");
&loadLang($bot_misc_dir. "/blootbot.lang");
&loadIRCServers($bot_misc_dir. "/ircII.servers");
&loadUsers($bot_misc_dir. "/blootbot.users");
+ if (&IsParam("WIP")) {
+ require "src/UserFile.pl";
+ &NEWloadUsers($bot_misc_dir."/blootbot.users_NEW");
+ &closePID();
+ &closeLog();
+ exit 0;
+ }
$shm = &openSHM();
+ &openSQLDebug() if (&IsParam("SQLDebug"));
&openDB($param{'DBName'}, $param{'SQLUser'}, $param{'SQLPass'});
&status("Setup: ". &countKeys("factoids") ." factoids.");
sub setupConfig {
$param{'VERBOSITY'} = 1;
&loadConfig($bot_misc_dir."/blootbot.config");
+ if (&IsParam("WIP")) {
+ require "src/Config.pl";
+ &NEWloadConfig();
+ }
- foreach ("ircNick", "ircUser", "ircName", "DBType") {
+ foreach ("ircNick", "ircUser", "ircName", "DBType", "tempDir") {
next if &IsParam($_);
&ERROR("Parameter $_ has not been defined.");
exit 1;
}
+ if (! -d $param{tempDir}) {
+ &status("making $param{tempDir}...");
+ system("mkdir $param{tempDir}");
+ }
+
# static scalar variables.
$file{utm} = "$bot_base_dir/$param{'ircUser'}.uptime";
$file{PID} = "$bot_base_dir/$param{'ircUser'}.pid";
my ($sig) = @_;
if ($$ == $bot_pid) {
- &status("$sig called.");
+ &status("--- $sig called.");
### crappy bug in Net::IRC?
if (!$conn->connected and time - $msgtime > 900) {
&shutdown();
&loadConfig($bot_misc_dir."/blootbot.config");
- &reloadModules() if (&IsParam("DEBUG"));
+ &reloadAllModules() if (&IsParam("DEBUG"));
&setup();
- &status("End of $sig.");
+ &status("--- End of $sig.");
} else {
&status("$sig called; ignoring restart.");
}