]> git.donarmstrong.com Git - infobot.git/commitdiff
- another round of patches from lear. "we love you, lear!" j/k :o
authordms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Thu, 4 Oct 2001 14:13:39 +0000 (14:13 +0000)
committerdms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Thu, 4 Oct 2001 14:13:39 +0000 (14:13 +0000)
- basically allows asuffield to include his FHS patch much easily
- er, how the hell do I use cvs?

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

src/CommandStubs.pl
src/DynaConfig.pl
src/Factoids/Statement.pl
src/Files.pl
src/IRC/Schedulers.pl
src/Misc.pl
src/Modules/Debian.pl
src/Modules/Units.pl
src/core.pl
src/db_mysql.pl

index 9b9eec568a7916d7e412aa47d3491891e30f6eeb..96713d6062d50e413c03cc3194cb5c31ea1f2b54 100644 (file)
@@ -724,7 +724,7 @@ sub lart {
        }
     }
 
-    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;
index b64ba0b24183f182d12ccd97d5dbc2426bfdd815..d90f6fafd8f7be28cda8f7ea80a4164bf62ea491 100644 (file)
@@ -13,7 +13,7 @@ if (&IsParam("useStrict")) { use strict; }
 #####
 
 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.");
@@ -122,7 +122,7 @@ sub writeUserFile {
        return;
     }
 
-    if (!open OUT,">$bot_misc_dir/blootbot.users") {
+    if (!open OUT,">$bot_state_dir/blootbot.users") {
        &ERROR("cannot write to userfile.");
        return;
     }
@@ -226,7 +226,7 @@ sub writeUserFile {
 #####
 
 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~";
@@ -297,7 +297,7 @@ sub writeChanFile {
        return;
     }
 
-    if (!open OUT,">$bot_misc_dir/blootbot.chan") {
+    if (!open OUT,">$bot_state_dir/blootbot.chan") {
        &ERROR("cannot write chanfile.");
        return;
     }
index ae0ffa4b6f78292d88c7d1909f08b75aab289212..edd69cf179441edd25b31d6001a1bfa79746f734 100644 (file)
@@ -55,6 +55,9 @@ sub doStatement {
     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
 
index a75b1dd4100b9a4834a110f92408f706dfcbadaa..b302604d09a46c2b4e6f1bf4c4cae764a3ca86f9 100644 (file)
@@ -49,7 +49,7 @@ sub loadLang {
 
 # File: Irc Servers list.
 sub loadIRCServers {
-    my ($file) = $bot_misc_dir."/ircII.servers";
+    my ($file) = $bot_config_dir."/ircII.servers";
     @ircServers = ();
     %ircPort = ();
 
index cde5537fd12676123de783993b7aaca838997540..b1e28c44a8baca38ef5fd9c1e0e1a9595f9037ff 100644 (file)
@@ -89,7 +89,7 @@ sub randomQuote {
        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;
@@ -817,8 +817,8 @@ sub miscCheck {
     }
 
     # 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}
@@ -853,14 +853,19 @@ sub miscCheck2 {
     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;
 }
index 6edda5f293fc8a00ace44c67018bea00882a6071..c0e25dc625b84588438d1d9c951c76cbcd9c8c55 100644 (file)
@@ -9,7 +9,7 @@ if (&IsParam("useStrict")) { use strict; }
 
 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.
index 1053f167839094d0b884cc74c30dd0495fdaff56..eb7f2e0c217549d6bb23d28847cae60c14709b3d 100644 (file)
@@ -15,6 +15,7 @@ my $defaultdist       = "sid";
 my $refresh = &::getChanConfDefault("debianRefreshInterval",7)
                        * 60 * 60 * 24;
 my $debug      = 0;
+my $debian_dir = "$::bot_state_dir/debian";
 
 ### ... old
 #my %dists     = (
@@ -33,32 +34,32 @@ 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",
 );
@@ -74,9 +75,9 @@ sub DebianDownload {
     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.
@@ -1058,7 +1059,7 @@ sub fixDist {
        $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;
 }
index 3aea58281c2dd8f2392114ce8c474179f5304b22..c24ea42c256a1d841199dc4dd2c102378c20972d 100644 (file)
@@ -49,7 +49,7 @@ BEGIN {
 ################################################################
 
 { 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");
index c8696653f0f3c18af99c80e5310a26a20bea695c..a51064bfbc4ad855e8aeef02941536386b044081 100644 (file)
@@ -10,13 +10,13 @@ use strict;
 # 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
@@ -388,7 +388,7 @@ sub setup {
     }
 
     # read.
-    &loadLang($bot_misc_dir.           "/blootbot.lang");
+    &loadLang($bot_data_dir. "/blootbot.lang");
     &loadIRCServers();
     &readUserFile();
     &readChanFile();
@@ -416,7 +416,7 @@ sub setup {
 
 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($_);
@@ -439,8 +439,8 @@ sub setupConfig {
     }
 
     # 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 {
@@ -492,7 +492,7 @@ sub restart {
 
        &DCCBroadcast("-HUP called.","m");
        &shutdown();
-       &loadConfig($bot_misc_dir."/blootbot.config");
+       &loadConfig($bot_config_dir."/blootbot.config");
        &reloadAllModules() if (&IsParam("DEBUG"));
        &setup();
 
index cb7b136f8b4f3b7bee55797394a572c0e9b288d3..b4820513cba9a10bc24dd5f1fa183292b18b4fa4 100644 (file)
@@ -457,7 +457,7 @@ sub searchTable {
 
 sub dbCreateTable {
     my($table) = @_;
-    my(@path)  = (".","..","../..");
+    my(@path)  = ($bot_data_dir, ".","..","../..");
     my $found  = 0;
     my $data;