}
}
- my $line = &getRandomLineFromFile($bot_misc_dir. "/blootbot.lart");
+ my $line = &getRandomLineFromFile($bot_data_dir. "/blootbot.lart");
if (defined $line) {
if ($target =~ /^(me|you|itself|\Q$ident\E)$/i) {
$line =~ s/WHO/$who/g;
#####
sub readUserFile {
- my $f = "$bot_misc_dir/blootbot.users";
+ my $f = "$bot_state_dir/blootbot.users";
if (! -f $f) {
&DEBUG("userfile not found; new fresh run detected.");
return;
}
- if (!open OUT,">$bot_misc_dir/blootbot.users") {
+ if (!open OUT,">$bot_state_dir/blootbot.users") {
&ERROR("cannot write to userfile.");
return;
}
#####
sub readChanFile {
- my $f = "$bot_misc_dir/blootbot.chan";
+ my $f = "$bot_state_dir/blootbot.chan";
if ( -f $f and -f "$f~") {
my $s1 = -s $f;
my $s2 = -s "$f~";
return;
}
- if (!open OUT,">$bot_misc_dir/blootbot.chan") {
+ if (!open OUT,">$bot_state_dir/blootbot.chan") {
&ERROR("cannot write chanfile.");
return;
}
if ($in =~ /(^|\s)(is|are)(\s|$)/i) {
my($lhs, $mhs, $rhs) = ($`, $&, $');
+ # allows factoid arguments to be updated. -lear.
+ $lhs =~ s/^(CMD: )?(.*)/$1 . lc $2/e;
+
$lhs =~ tr/A-Z/a-z/;
$lhs =~ s/^(the|da|an?)\s+//i; # discard article
# File: Irc Servers list.
sub loadIRCServers {
- my ($file) = $bot_misc_dir."/ircII.servers";
+ my ($file) = $bot_config_dir."/ircII.servers";
@ircServers = ();
%ircPort = ();
return if ($_[0] eq "2"); # defer.
}
- my $line = &getRandomLineFromFile($bot_misc_dir. "/blootbot.randtext");
+ my $line = &getRandomLineFromFile($bot_data_dir. "/blootbot.randtext");
if (!defined $line) {
&ERROR("random Quote: weird error?");
return;
}
# make backup of important files.
- &mkBackup( $bot_misc_dir."/blootbot.chan", 60*60*24*3);
- &mkBackup( $bot_misc_dir."/blootbot.users", 60*60*24*3);
+ &mkBackup( $bot_state_dir."/blootbot.chan", 60*60*24*3);
+ &mkBackup( $bot_state_dir."/blootbot.users", 60*60*24*3);
&mkBackup( $bot_base_dir."/blootbot-news.txt", 60*60*24*1);
# flush cache{lobotomy}
my ($day,$month,$year) = (localtime(time()))[3,4,5];
my $date = sprintf("%04d%02d%02d",$year+1900,$month+1,$day);
- opendir(DIR,"$bot_base_dir/log");
+ if (!opendir(DIR,"$bot_log_dir")) {
+ &ERROR("misccheck2: log dir $bot_log_dir does not exist.");
+ closedir DIR;
+ return -1;
+ }
+
while (my $f = readdir(DIR)) {
- next unless ( -f "$bot_base_dir/log/$f");
+ next unless ( -f "$bot_log_dir/$f");
next if ($f =~ /gz|bz2/);
next unless ($f =~ /(\d{8})/);
next if ($date eq $1);
- &compress("$bot_base_dir/log/$f");
+ &compress("$bot_log_dir/$f");
}
closedir DIR;
}
sub help {
my $topic = shift;
- my $file = $bot_misc_dir."/blootbot.help";
+ my $file = $bot_data_dir."/blootbot.help";
my %help = ();
# crude hack for pSReply() to work as expected.
my $refresh = &::getChanConfDefault("debianRefreshInterval",7)
* 60 * 60 * 24;
my $debug = 0;
+my $debian_dir = "$::bot_state_dir/debian";
### ... old
#my %dists = (
);
my %urlcontents = (
- "debian/Contents-##DIST-i386.gz" =>
+ "Contents-##DIST-i386.gz" =>
"ftp://ftp.us.debian.org".
"/debian/dists/##DIST/Contents-i386.gz",
- "debian/Contents-##DIST-i386-non-US.gz" =>
+ "Contents-##DIST-i386-non-US.gz" =>
"ftp://non-us.debian.org".
"/debian-non-US/dists/##DIST/non-US/Contents-i386.gz",
);
my %urlpackages = (
- "debian/Packages-##DIST-main-i386.gz" =>
+ "Packages-##DIST-main-i386.gz" =>
"ftp://ftp.us.debian.org".
"/debian/dists/##DIST/main/binary-i386/Packages.gz",
- "debian/Packages-##DIST-contrib-i386.gz" =>
+ "Packages-##DIST-contrib-i386.gz" =>
"ftp://ftp.us.debian.org".
"/debian/dists/##DIST/contrib/binary-i386/Packages.gz",
- "debian/Packages-##DIST-non-free-i386.gz" =>
+ "Packages-##DIST-non-free-i386.gz" =>
"ftp://ftp.us.debian.org".
"/debian/dists/##DIST/non-free/binary-i386/Packages.gz",
- "debian/Packages-##DIST-non-US-main-i386.gz" =>
+ "Packages-##DIST-non-US-main-i386.gz" =>
"ftp://non-us.debian.org".
"/debian-non-US/dists/##DIST/non-US/main/binary-i386/Packages.gz",
- "debian/Packages-##DIST-non-US-contrib-i386.gz" =>
+ "Packages-##DIST-non-US-contrib-i386.gz" =>
"ftp://non-us.debian.org".
"/debian-non-US/dists/##DIST/non-US/contrib/binary-i386/Packages.gz",
- "debian/Packages-##DIST-non-US-non-free-i386.gz" =>
+ "Packages-##DIST-non-US-non-free-i386.gz" =>
"ftp://non-us.debian.org".
"/debian-non-US/dists/##DIST/non-US/non-free/binary-i386/Packages.gz",
);
my $bad = 0;
my $good = 0;
- if (! -d "debian/") {
+ if (! -d $debian_dir) {
&::status("Debian: creating debian dir.");
- mkdir("debian/",0755);
+ mkdir($debian_dir, 0755);
}
# fe dists.
$key =~ s/##DIST/$dist/;
$val =~ s/##DIST/$dist/;
### TODO: what should we do if the sar wasn't done.
- $new{$key} = $val;
+ $new{$debian_dir."/".$key} = $val;
}
return %new;
}
################################################################
{ my $defs_read = 0;
- $defs_read += read_defs("$::bot_misc_dir/unittab");
+ $defs_read += read_defs("$::bot_data_dir/unittab");
unless ($defs_read) {
&::ERROR("Could not read any of the initialization files UNITTAB");
# dynamic scalar. MUST BE REDUCED IN SIZE!!!
### TODO: reorder.
use vars qw(
+ $bot_misc_dir $bot_pid $bot_base_dir $bot_src_dir
$answer $correction_plausible $talkchannel $bot_release
$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
+ $shm $host $msg $noreply $conn $irc $learnok $nick $ident
$force_public_reply $addrchar $userHandle $addressedother
$floodwho $chan $msgtime $server $firsttime $wingaterun
- $flag_quit $msgType
+ $flag_quit $msgType $no_syscall
$utime_userfile $wtime_userfile $ucount_userfile
$utime_chanfile $wtime_chanfile $ucount_chanfile
$pubsize $pubcount $pubtime
}
# read.
- &loadLang($bot_misc_dir. "/blootbot.lang");
+ &loadLang($bot_data_dir. "/blootbot.lang");
&loadIRCServers();
&readUserFile();
&readChanFile();
sub setupConfig {
$param{'VERBOSITY'} = 1;
- &loadConfig($bot_misc_dir."/blootbot.config");
+ &loadConfig($bot_config_dir."/blootbot.config");
foreach ("ircNick", "ircUser", "ircName", "DBType", "tempDir") {
next if &IsParam($_);
}
# static scalar variables.
- $file{utm} = "$bot_base_dir/$param{'ircUser'}.uptime";
- $file{PID} = "$bot_base_dir/$param{'ircUser'}.pid";
+ $file{utm} = "$bot_state_dir/$param{'ircUser'}.uptime";
+ $file{PID} = "$bot_run_dir/$param{'ircUser'}.pid";
}
sub startup {
&DCCBroadcast("-HUP called.","m");
&shutdown();
- &loadConfig($bot_misc_dir."/blootbot.config");
+ &loadConfig($bot_config_dir."/blootbot.config");
&reloadAllModules() if (&IsParam("DEBUG"));
&setup();
sub dbCreateTable {
my($table) = @_;
- my(@path) = (".","..","../..");
+ my(@path) = ($bot_data_dir, ".","..","../..");
my $found = 0;
my $data;