X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=src%2Fmodules.pl;h=278e673309bbce59d9d281a86636f545c7c03bf8;hb=b28802c40e8775f2a9457b833e2014ccc2f4161c;hp=36e3204529c8cd8d14ce3116e52ff6acbd518b06;hpb=84c597757c4f23ad1a26c6322d9fd2af479567c9;p=infobot.git diff --git a/src/modules.pl b/src/modules.pl index 36e3204..278e673 100644 --- a/src/modules.pl +++ b/src/modules.pl @@ -5,7 +5,8 @@ # Created: 20000624 # -#use strict; +# use strict; # TODO + use vars qw($AUTOLOAD); ### @@ -21,18 +22,20 @@ if ($@) { ### MODULES. %myModules = ( + "bzflag" => "BZFlag.pl", "countdown" => "Countdown.pl", "debian" => "Debian.pl", "debianExtra" => "DebianExtra.pl", "dict" => "Dict.pl", "dumpvars" => "DumpVars.pl", "symdump" => "DumpVars2.pl", + "exchange" => "Exchange.pl", "factoids" => "Factoids.pl", "freshmeat" => "Freshmeat.pl", "kernel" => "Kernel.pl", - "ircdcc" => "UserDCC.pl", "perlMath" => "Math.pl", "news" => "News.pl", + "plug" => "Plug.pl", "quote" => "Quote.pl", "rootwarn" => "RootWarn.pl", "search" => "Search.pl", @@ -40,26 +43,32 @@ if ($@) { "topic" => "Topic.pl", "units" => "Units.pl", "uptime" => "Uptime.pl", + "ircdcc" => "UserDCC.pl", "userinfo" => "UserInfo.pl", + "weather" => "Weather.pl", "wwwsearch" => "W3Search.pl", "whatis" => "WhatIs.pl", "wingate" => "Wingate.pl", + "babelfish" => "babel.pl", "insult" => "insult.pl", "nickometer" => "nickometer.pl", - "babelfish" => "babel.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/$_"; @@ -77,43 +86,23 @@ sub loadCoreModules { } sub loadDBModules { - &status("Loading DB modules..."); - - 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) { + if ($param{'DBType'} =~ /^(mysql|SQLite|pgsql)$/i) { eval "use DBI"; if ($@) { - &ERROR("libdbd-mysql-perl is not installed!"); + &ERROR("No support for DBI::" . $param{'DBType'} . ", exiting!"); exit 1; } - &showProc(" (DBI // mysql)"); - - &status(" using MySQL support."); - $f = "$bot_src_dir/db_mysql.pl"; + &status("Loading " . $param{'DBType'} . " support."); + $f = "$bot_src_dir/dbi.pl"; require $f; $moduleAge{$f} = (stat $f)[9]; - } elsif ($param{'DBType'} =~ /^pgsql$/i) { -# eval "use Pg"; - eval "use DBI"; - if ($@) { - &ERROR("libpgperl is not installed!"); - exit 1; - } - &showProc(" (pgsql)"); - - &status(" using pgsql support."); - require "$bot_src_dir/db_pgsql.pl"; - - } elsif ($param{'DBType'} =~ /^dbm$/i) { - - &status(" using Berkeley DBM support."); - require "$bot_src_dir/db_dbm.pl"; + &showProc(" (DBI::" . $param{'DBType'} . ")"); } else { - - &status("DB support DISABLED."); + &WARN("DB support DISABLED."); return; } } @@ -153,15 +142,17 @@ 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") ) { my $mod = "$bot_src_dir/$interface/$_"; - &status("Loading Modules \"$mod\""); + # hrm... use another config option besides DEBUG to display + # change in memory usage. + &status("Loading Modules \"$mod\"") if (!&IsParam("DEBUG")); eval "require \"$mod\""; if ($@) { &ERROR("require \"$mod\" => $@"); @@ -334,7 +325,7 @@ sub loadMyModule { &shutdown() if (defined $shm and defined $dbh); } else { # child. &DEBUG("b4 delfork 1"); - &delForked($modulebase); + &delForked($modulename); } exit 1; @@ -345,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; }