# Created: 20000624
#
-# use strict; # TODO
+use strict;
-use vars qw($AUTOLOAD);
+use vars qw($AUTOLOAD $no_timehires);
###
### REQUIRED MODULES.
}
&showProc(" (IO::Socket)");
-### MODULES.
-%myModules = (
- "babelfish" => "babelfish.pl",
- "botmail" => "botmail.pl",
- "BZFlag" => "BZFlag.pl",
- "countdown" => "countdown.pl",
- "Debian" => "Debian.pl",
- "DebianExtra" => "DebianExtra.pl",
- "Dict" => "Dict.pl",
- "DumpVars" => "DumpVars.pl",
- "Exchange" => "Exchange.pl",
- "Factoids" => "Factoids.pl",
- "HTTPDtype" => "HTTPDtype.pl",
- "insult" => "insult.pl",
- "UserDCC" => "UserDCC.pl",
- "Kernel" => "Kernel.pl",
- "News" => "News.pl",
- "nickometer" => "nickometer.pl",
- "pager" => "pager.pl",
- "Math" => "Math.pl",
- "Plug" => "Plug.pl",
- "Quote" => "Quote.pl",
- "RootWarn" => "RootWarn.pl",
- "Rss" => "Rss.pl",
- "Search" => "Search.pl",
- "slashdot" => "slashdot.pl",
- "DumpVars2" => "DumpVars2.pl",
- "Topic" => "Topic.pl",
- "Units" => "Units.pl",
- "Uptime" => "Uptime.pl",
- "UserInfo" => "UserInfo.pl",
- "weather" => "Weather.pl",
- "whatis" => "WhatIs.pl",
- "wikipedia" => "wikipedia.pl",
- "wingate" => "Wingate.pl",
- "wwwsearch" => "W3Search.pl",
- "zfi" => "zfi.pl",
- "zippy" => "Zippy.pl",
- "zsi" => "zsi.pl",
-);
### THIS IS NOT LOADED ON RELOAD :(
my @myModulesLoadNow;
my @myModulesReloadNot;
my $f;
# TODO: use function to load module.
- if ($param{'DBType'} =~ /^(mysql|SQLite|pgsql)$/i) {
+ if ($param{'DBType'} =~ /^(mysql|SQLite(2)?|pgsql)$/i) {
eval "use DBI";
if ($@) {
&ERROR("No support for DBI::" . $param{'DBType'} . ", exiting!");
}
if (!&IsParam($_) and !&IsChanConf($_) and !&getChanConfList($_)) {
- if (exists $myModules{$_}) {
- &status("myModule: $myModules{$_} or $_ (1) not loaded.");
- } else {
- &DEBUG("myModule: $_ (2) not loaded.");
- }
-
+ &DEBUG("loadMyModuleNow: $_ (2) not loaded.");
next;
}
- &loadMyModule($myModules{$_});
+ &loadMyModule($_);
$loaded++;
}
if ($age < $moduleAge{$file}) {
&WARN("rM: we're not gonna downgrade '$file'; use touch.");
- &DEBUG("age => $age");
- &DEBUG("mA{$file} => $moduleAge{$file}");
+ &DEBUG("age => $age, mA{$file} => $moduleAge{$file}");
return $retval;
}
}
sub loadMyModule {
- my ($tmp) = @_;
- if (!defined $tmp) {
+ my ($modulename) = @_;
+ if (!defined $modulename) {
&WARN("loadMyModule: module is NULL.");
return 0;
}
- my ($modulename, $modulebase);
- if (exists $myModules{$tmp}) {
- ($modulename, $modulebase) = ($tmp, $myModules{$tmp});
- } else {
- $modulebase = $tmp;
- if ($tmp = grep /^$modulebase$/, keys %myModules) {
- &DEBUG("lMM: lame hack, file => name => $tmp.");
- $modulename = $tmp;
- }
- }
- my $modulefile = "$bot_src_dir/Modules/$modulebase";
+ my $modulefile = "$bot_src_dir/Modules/$modulename.pl";
# call reloadModule() which checks age of file and reload.
- if (grep /\/$modulebase$/, keys %INC) {
- &reloadModule($modulebase);
+ if (grep /\/$modulename$/, keys %INC) {
+ &reloadModule($modulename);
return 1; # depend on reloadModule?
}
if (! -f $modulefile) {
- &ERROR("lMM: module ($modulebase) does not exist.");
+ &ERROR("lMM: module ($modulename) does not exist.");
if ($$ == $bot_pid) { # parent.
&shutdown() if (defined $shm and defined $dbh);
} else { # child.
eval "require \"$modulefile\"";
if ($@) {
- &ERROR("cannot load my module: $modulebase");
+ &ERROR("cannot load my module: $modulename");
if ($bot_pid != $$) { # child.
&DEBUG("b4 delfork 2");
&delForked($modulename);
} else {
$moduleAge{$modulefile} = (stat $modulefile)[9];
- &status("Loaded $modulebase");
- &showProc(" ($modulebase)");
+ &status("Loaded $modulename");
+ &showProc(" ($modulename)");
return 1;
}
}
$AUTOLOAD =~ s/^(\S+):://g;
- if (exists $myModules{lc $AUTOLOAD}) {
- # hopefully this will work.
- &DEBUG("Trying to load module $AUTOLOAD...");
- &loadMyModule(lc $AUTOLOAD);
- }
+ # hopefully this will work.
+ &DEBUG("Trying to load module $AUTOLOAD...");
+ &loadMyModule($AUTOLOAD);
}
sub getPerlFiles {