]> git.donarmstrong.com Git - infobot.git/blobdiff - src/modules.pl
remove Berkeley DBM support
[infobot.git] / src / modules.pl
index 0861982c778e89fe1a43388ea6d27d340947df56..278e673309bbce59d9d281a86636f545c7c03bf8 100644 (file)
@@ -5,7 +5,8 @@
 #     Created: 20000624
 #
 
-#use strict;
+# use strict;  # TODO
+
 use vars qw($AUTOLOAD);
 
 ###
@@ -28,6 +29,7 @@ if ($@) {
        "dict"          => "Dict.pl",
        "dumpvars"      => "DumpVars.pl",
        "symdump"       => "DumpVars2.pl",
+       "exchange"      => "Exchange.pl",
        "factoids"      => "Factoids.pl",
        "freshmeat"     => "Freshmeat.pl",
        "kernel"        => "Kernel.pl",
@@ -43,6 +45,7 @@ if ($@) {
        "uptime"        => "Uptime.pl",
        "ircdcc"        => "UserDCC.pl",
        "userinfo"      => "UserInfo.pl",
+       "weather"       => "Weather.pl",
        "wwwsearch"     => "W3Search.pl",
        "whatis"        => "WhatIs.pl",
        "wingate"       => "Wingate.pl",
@@ -50,20 +53,22 @@ if ($@) {
        "insult"        => "insult.pl",
        "nickometer"    => "nickometer.pl",
        "zfi"           => "zfi.pl",
+       "zippy"         => "Zippy.pl",
        "zsi"           => "zsi.pl",
+       "botmail"       => "botmail.pl",
 );
 ### THIS IS NOT LOADED ON RELOAD :(
 my @myModulesLoadNow;
 my @myModulesReloadNot;
 BEGIN {
-    @myModulesLoadNow  = ('topic', 'uptime', 'news', 'rootWarn', 'symdump');
+    @myModulesLoadNow  = ('topic', 'uptime', 'news', 'rootWarn', 'symdump', 'botmail');
     @myModulesReloadNot        = ('IRC/Irc.pl','IRC/Schedulers.pl');
 }
 
 sub loadCoreModules {
     my @mods = &getPerlFiles($bot_src_dir);
 
-    &status("Loading ".scalar(@mods)." CORE modules...");
+    &status("Loading CORE modules...");
 
     foreach (sort @mods) {
        my $mod = "$bot_src_dir/$_";
@@ -81,38 +86,23 @@ sub loadCoreModules {
 }
 
 sub loadDBModules {
-    my $f = "$bot_src_dir/modules.pl";
-    $moduleAge{$f} = (stat $f)[9];
+    my $f;
+    # todo: use function to load module.
 
-    if ($param{'DBType'} =~ /^mysql$/i) {
-       eval "use DBI";
-       if ($@) {
-           &ERROR("libdbd-mysql-perl is not installed!");
-           exit 1;
-       }
-       &status("Loading MySQL support.");
-       $f = "$bot_src_dir/db_mysql.pl";
-       require $f;
-       $moduleAge{$f} = (stat $f)[9];
-       &showProc(" (DBI // mysql)");
-    } elsif ($param{'DBType'} =~ /^pgsql$/i) {
-#      eval "use Pg";
+    if ($param{'DBType'} =~ /^(mysql|SQLite|pgsql)$/i) {
        eval "use DBI";
        if ($@) {
-           &ERROR("libpgperl is not installed!");
+           &ERROR("No support for DBI::" . $param{'DBType'} . ", exiting!");
            exit 1;
        }
-       &status("Loading pgsql support.");
-       require "$bot_src_dir/db_pgsql.pl";
-       &showProc(" (pgsql)");
-    } elsif ($param{'DBType'} =~ /^dbm$/i) {
-       &status("Loading Berkeley DBM support.");
-       $f = "$bot_src_dir/db_dbm.pl";
+       &status("Loading " . $param{'DBType'} . " support.");
+       $f = "$bot_src_dir/dbi.pl";
        require $f;
        $moduleAge{$f} = (stat $f)[9];
-       &showProc(" $bot_src_dir/db_dbm.pl");
+
+       &showProc(" (DBI::" . $param{'DBType'} . ")");
     } else {
-       &status("DB support DISABLED.");
+       &WARN("DB support DISABLED.");
        return;
     }
 }
@@ -152,9 +142,9 @@ sub loadIRCModules {
        &showProc(" (Net::IRC)");
     } else {
        &status("IRC support DISABLED.");
-       # disabling forking.
-       $param{forking} = 0;
-       $param{noSHM}   = 1;
+       # disabling forking. Why?
+       #$param{forking}        = 0;
+       #$param{noSHM}  = 1;
     }
 
     foreach ( &getPerlFiles("$bot_src_dir/$interface") ) {
@@ -335,7 +325,7 @@ sub loadMyModule {
            &shutdown() if (defined $shm and defined $dbh);
        } else {                        # child.
            &DEBUG("b4 delfork 1");
-           &delForked($modulebase);
+           &delForked($modulename);
        }
 
        exit 1;
@@ -346,7 +336,7 @@ sub loadMyModule {
        &ERROR("cannot load my module: $modulebase");
        if ($bot_pid != $$) {   # child.
            &DEBUG("b4 delfork 2");
-           &delForked($modulebase);
+           &delForked($modulename);
            exit 1;
        }