]> git.donarmstrong.com Git - infobot.git/blobdiff - src/UserExtra.pl
- sql function changeover stuff.
[infobot.git] / src / UserExtra.pl
index c26b3b3d511e4d8c67e0fb54b0f4771763fca6c1..e38fa950b04a0495ff5fdadd765123d54564d028 100644 (file)
@@ -5,9 +5,11 @@
 #      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.
@@ -18,7 +20,7 @@ use vars qw(%channels %chanstats %cmdstats);
 &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', ) );
@@ -788,9 +790,9 @@ sub userCommands {
 
     # 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) {
@@ -810,16 +812,20 @@ sub userCommands {
          " 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."
        );
 
-       # todo: make dbGetColNiceHash().
-       my %hash = &dbGetCol("stats", "nick,counter", "type='cmdstats'".
-#                      " ORDER BY counter DESC LIMIT 3", 1);
-                       " ORDER BY counter DESC", 1);
+       return;
+
+       # todo: use dbGetColNiceHash().
+       my %hash = &sqlSelectColHash("stats", "nick,counter",
+               { type => "cmdstats" }, 1);
+# does ORDER matter when used with a hash?
+#                      " ORDER BY counter DESC", 1);
 
+if (0) {
        foreach (keys %hash) {
            my $i = $_;
            foreach (keys %{ $hash{$i} }) {
@@ -827,6 +833,7 @@ sub userCommands {
            }
        }
        &DEBUG("end of cmdstats.");
+}
 
        return;
     }