# Created: 20000107
#
-#use strict;
-use vars qw($message $arg $qWord $verb $lobotomized);
-use vars qw(%channels %chanstats %cmdstats);
+use strict;
+use vars qw($message $arg $qWord $verb $lobotomized $who $result $chan
+ $conn $msgType $query $talkchannel $ident $memusage);
+use vars qw(%channels %chanstats %cmdstats %count %ircstats %param
+ %cache %mask %userstats %hooks_main);
###
### Start of command hooks for UserExtra.
&addCmdHook("main", 'factinfo', ('CODEREF' => 'factinfo',
'Cmdstats' => 'Factoid Info', Module => 'factoids', ) );
&addCmdHook("main", 'factstats?', ('CODEREF' => 'factstats',
- 'Cmdstats' => 'Factoid Statistics', Help => "factstats",
+ 'Cmdstats' => 'Factoid Stats', Help => "factstats",
Forker => 1, 'Identifier' => 'factoids', ) );
&addCmdHook("main", 'help', ('CODEREF' => 'help',
'Cmdstats' => 'Help', ) );
sub karma {
my $target = lc( shift || $who );
- my $karma = &dbGet("stats", "counter", "nick=".
- &dbQuote($target)." AND type='karma'") || 0;
+ my $karma = &sqlSelect("stats", "counter",
+ { nick => $target, type => "karma" }) || 0;
if ($karma != 0) {
&pSReply("$target has karma of $karma");
# status.
if ($message =~ /^statu?s$/i) {
- my $startString = scalar(localtime $^T);
+ my $startString = scalar(gmtime $^T);
my $upString = &Time2String(time() - $^T);
- my $count = &countKeys("factoids");
+ my $factoids = &countKeys("factoids");
$count{'Commands'} = 0;
foreach (keys %cmdstats) {
" and \002$count{'Commands'}\002 ".
&fixPlural("command",$count{'Commands'}).
". I have been awake for $upString this session, and ".
- "currently reference \002$count\002 factoids. ".
+ "currently reference \002$factoids\002 factoids. ".
"I'm using about \002$memusage\002 ".
"kB of memory."
);
+ return;
+
# todo: use dbGetColNiceHash().
- my %hash = &dbGetCol("stats", "nick,counter", "type='cmdstats'".
-# " ORDER BY counter DESC LIMIT 3", 1);
- " ORDER BY counter DESC", 1);
+ my %hash = &sqlSelectColHash("stats", "nick,counter",
+ { type => "cmdstats" }, 1);
+# ORDER won't be retained in a hash
+# " ORDER BY counter DESC", 1);
if (0) {
foreach (keys %hash) {