]> git.donarmstrong.com Git - infobot.git/blobdiff - src/IRC/IrcHooks.pl
- added support of ircTextCounters - works! thanks to #perl@OPN.
[infobot.git] / src / IRC / IrcHooks.pl
index e90d26745842a8fb7c1403e493f4ef8ea8df6712..05a6fc04ab7b6d81ae41d4059817d4ca741af329 100644 (file)
@@ -790,9 +790,20 @@ sub on_public {
        $userstats{lc $nick}{'Time'} = time();
     }
 
-#    if (&IsChanConf("hehCounter")) {
-#      #...
-#    }
+    # would this slow things down?
+    if ($_ = &getChanConf("ircTextCounters")) {
+       foreach (split /[\s]+/) {
+           next unless ($msg =~ /^\Q$_\E$/i);
+           &status("textcounters: $_ matched for $who");
+
+           my $v = &dbGet("stats", "counter", "nick='$who' and type='$msg'");
+           $v++;
+
+           &dbReplace("stats", (nick => $who, type => $_, counter => $v) );
+           # does not work, atleast with old mysql!!! :(
+#          &dbReplace("stats", (nick => $who, type => $_, -counter => "counter+1") );
+       }
+    }
 
     &hookMsg('public', $chan, $nick, $msg);
     $chanstats{$chan}{'PublicMsg'}++;