X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=src%2FUserExtra.pl;h=7079f6a7b96b4b13d7b6676d8b1e3756090d66c8;hb=c53a047e7a5f63c954a2ce515687a937ca8720f3;hp=f4cb80904acb802a5ecc3809a2fc04180ef3a75c;hpb=2d050e260224ba7bdaf92ee1f9b2cffdc2c9f006;p=infobot.git diff --git a/src/UserExtra.pl b/src/UserExtra.pl index f4cb809..7079f6a 100644 --- a/src/UserExtra.pl +++ b/src/UserExtra.pl @@ -219,7 +219,8 @@ sub factstats { sub karma { my $target = lc( shift || $who ); - my $karma = &dbGet("stats", "counter", "nick='$target' and type='karma'") || 0; + my $karma = &dbGet("stats", "counter", "nick=". + &dbQuote($target)." AND type='karma'") || 0; if ($karma != 0) { &pSReply("$target has karma of $karma"); @@ -392,8 +393,8 @@ sub DNS { $dns =~ s/^\s+|\s+$//g; if ($dns =~ /(\d+\.\d+\.\d+\.\d+)/) { - &status("DNS query by IP address: $in"); $match = $1; + &status("DNS query by IP address: $match"); $y = pack('C4', split(/\./, $match)); $x = (gethostbyaddr($y, &AF_INET)); @@ -762,6 +763,7 @@ sub userCommands { my $startString = scalar(localtime $^T); my $upString = &Time2String(time() - $^T); my $count = &countKeys("factoids"); + $count{'Commands'} = 0; foreach (keys %cmdstats) { $count{'Commands'} += $cmdstats{$_}; @@ -785,6 +787,16 @@ sub userCommands { "kB of memory." ); + # todo: make dbGetColNiceHash(). + my %hash = &dbGetCol("stats", "nick,counter", "type='cmdstats'". +# " ORDER BY counter DESC LIMIT 3", 1); + " ORDER BY counter DESC", 1); + + foreach (keys %hash) { + &DEBUG("cmdstats: hash{$_} => $hash{$_}"); + } + &DEBUG("end of cmdstats."); + return; }