]> git.donarmstrong.com Git - infobot.git/blobdiff - src/Misc.pl
- IsHostMatch: check for NULL.
[infobot.git] / src / Misc.pl
index 0b39297c98d5cc97f7d8a1bc6ff42a481f819c47..9379d7b10dae4e2fda048cfd3e6d580d213a63fc 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.
@@ -416,7 +416,10 @@ sub IsHostMatch {
        $local{'host'} = &makeHostMask(lc $3);
     }
 
-    if ($thisnuh =~ /^(\S+)!(\S+)@(\S+)/) {
+    if (!defined $thisnuh) {
+       &WARN("IHM: thisnuh == NULL.");
+       return 0;
+    } elsif ($thisnuh =~ /^(\S+)!(\S+)@(\S+)/) {
        $this{'nick'} = lc $1;
        $this{'user'} = lc $2;
        $this{'host'} = &makeHostMask(lc $3);
@@ -475,6 +478,7 @@ sub makeHostMask {
 
     if ($host =~ s/^(\S+!\S+\@)//) {
        &DEBUG("mHM: detected nick!user\@ for host arg; fixing");
+       &DEBUG("nu => $nu");
        $nu = $1;
     }
 
@@ -642,7 +646,7 @@ sub closeStats {
        );              
        $hash{time} = time() if ($z);
 
-       &dbReplace("stats", %hash);
+       &dbReplace("stats", "nick", %hash);
     }
 }