]> git.donarmstrong.com Git - infobot.git/blobdiff - src/UserExtra.pl
- fixed dns lookup
[infobot.git] / src / UserExtra.pl
index fc6e000c50e16bb64ef9adedddd57b50729eae84..b48158c9765deec2187de2a644d9986c832a3e4d 100644 (file)
@@ -33,7 +33,8 @@ use vars qw(%channels %chanstats %cmdstats);
        Help => 'tell', Identifier => 'allowTelling',
        Cmdstats => 'Tell') );
 &addCmdHook("main", 'news', ('CODEREF' => 'News::Parse', 
-       Module => 'news', 'Cmdstats' => 'News' ) );
+       Module => 'news', 'Cmdstats' => 'News',
+       Identifier => 'news' ) );
 &addCmdHook("main", 'countrystats', ('CODEREF' => 'countryStats', 
 #      Forker => "NULL",
  ) );
@@ -219,7 +220,7 @@ sub factstats {
 
 sub karma {
     my $target = lc( shift || $who );
-    my $karma  = &dbGet("karma", "nick",$target,"karma") || 0;
+    my $karma  = &dbGet("stats", "counter", "nick='$target' and type='karma'") || 0;
 
     if ($karma != 0) {
        &pSReply("$target has karma of $karma");
@@ -355,7 +356,7 @@ sub tell {
        $message        = $tell_obj;
        $done++ unless (&Modules());
 
-       &VERB("teel: setting old values of who and msgType.",2);
+       &VERB("tell: setting old values of who and msgType.",2);
        $who            = $oldwho;
        $msgType        = $oldmtype;
 
@@ -389,10 +390,12 @@ sub DNS {
     my $dns = shift;
     my($match, $x, $y, $result);
     my $pid;
+    $dns =~ s/^\s+|\s+$//g;
 
     if ($dns =~ /(\d+\.\d+\.\d+\.\d+)/) {
        &status("DNS query by IP address: $in");
        $match = $1;
+
        $y = pack('C4', split(/\./, $match));
        $x = (gethostbyaddr($y, &AF_INET));
 
@@ -401,12 +404,14 @@ sub DNS {
        } else {
            $result = "I can't seem to find that address in DNS";
         }
+
     } else {
-       &status("DNS query by name: $in");
-       $x = join('.',unpack('C4',(gethostbyname($in))[4]));
+
+       &status("DNS query by name: $dns");
+       $x = join('.',unpack('C4',(gethostbyname($dns))[4]));
 
        if ($x !~ /^\s*$/) {
-           $result = $in." is ".$x;
+           $result = $dns." is ".$x;
        } else {
            $result = "I can\'t find that machine name";
        }