Donate to the B3 fund!

"even a small donation helps!"
Donate with PayPal!
Most of the plugins here are made by B3 users and the authors may not visit frequently. If you need support for plugins or if questions remain unanswered, you will have to contact the author directly. Read the full Support Disclaimer here

NOTE: Do not attach plugins to your forumtopics! Attachements are periodically removed by maintenance tasks. Upload your plugins to our Downloads section instead!

Author Topic: chatlogger plugin  (Read 77818 times)

Offline Courgette

  • Senior Dev.
  • Hero Member
  • *
  • Posts: 4882
    • Github repository
chatlogger plugin
« on: July 28, 2008, 08:55:53 PM »
Description:

This plugin logs to database all clients' messages (chat, team chat, private chat).
It has an option to automatically delete old messages from database.
Following an idea from KaGDeadz discussed in this topic and thanks to BlackMamba work the chatlogger plugin also logs all B3 commands issued into database (in a dedicated table)

Changelog :

28/07/2008 - 0.0.1
 - manage say, teamsay and privatesay messages

14/08/2008 - 0.1.0
 - fix security issue with player names or messages containing double quote or antislash characters (Thx to Anubis for report and tests)
 - option to setup a daily purge of old messages to keep your database size reasonable

13/09/2008 - 0.1.1
 - in config, the hour defined for the purge is now understood in the timezone defined in the main B3 config file (before, was understood as UTC time)
 - fix mistake in log text

7/11/2008 - 0.1.2 - xlr8or
 - added missing 'import b3.timezones'

22/12/2008 - 0.2.0
 - allow to use a customized table name for storing the
   log to database. Usefull if multiple instances of the
   bot share the same database.
   Thanks to Eire.32 for bringing up the idea and testing.

16/04/2011 - 1.0
 - can log to a file instead of logging to database
 - /!\ requires B3 1.6+ /!\

01/09/2011 - 1.1.1
 - log commands to a new table

12/09/2011 - 1.1.2
 - start without failure even if the plugin is loaded before the admin plugin
 - do not fail to handle SQLite database errors

 Download (RSS feed)

App to display the log
 * echelon provide a way to display the chat log



« Last Edit: November 21, 2012, 11:38:51 PM by Courgette »

Offline |FaLLeN| Op-X

  • Full Member
  • ***
  • Posts: 97
    • |FaLLeN| Clan
Re: chatlogger plugin v0.0.1
« Reply #1 on: July 29, 2008, 02:51:54 AM »
installed and chat shows up on the tables :)
great work! just need the echelon page  :-*

xfire=specialopx
www.fallenclan.com

Offline wurst

  • Jr. Member
  • **
  • Posts: 22
Re: chatlogger plugin v0.0.1
« Reply #2 on: July 29, 2008, 11:14:01 AM »
weeeeee!

thx very much, i just installed --> working.
to query simply the output is maybe problematic cause privacy ethical copyright stuffs, im looking forward to authenticate it with phpbb.
so sry that i cant give a direct link now...

heres the script that i use to output html table. plz be patient, im no programmer i just stole several howtos with the gugel,
but i swear i will  make some nice, specially after i found out what to do with the msg_time   ;D

Code: [Select]
<?php
//wursti shitty klickery
//enter right text plz!!!!!!!!!!!!!!!!!!!!!:
$dbhost='localhost';
$dbusername='myuser';
$dbuserpass='mypw';
$dbname='b3DBname';
$header='playerchat table';




//connectomatrix.

$db = mysql_connect ($dbhost, $dbusername, $dbuserpass) or die(mysql_error());

//selectomatrix.

mysql_select_db($dbname, $db) or die('Cannot select database');

$query = 'SELECT  ch.`msg_time`, ch.`msg_type`, c.`name`, ch.`msg` FROM `chatlog` as ch INNER JOIN `clients` as c ON ch.`client_id` = c.`id`  ORDER BY `msg_time` DESC LIMIT 0, 50';
$result = mysql_query($query, $db);

if (mysql_errno($db) == 0)
echo "$header <br><br>";
else
 echo mysql_error();
 
//Call table

  ?><table><tr><?
  if(! $result) { ?><th>result not valid</th><? }
  else {
    $i = 0;
    while ($i < mysql_num_fields($result)) {
      $meta = mysql_fetch_field($result, $i);
      ?><th style="white-space:nowrap"><?=$meta->name?></th><?
      $i++;
    }
    ?></tr><?
   
    if(mysql_num_rows($result) == 0) {
      ?><tr><td colspan="<?=mysql_num_fields($result)?>">
      <strong><center>no result</center></strong>
      </td></tr><?
    } else
      while($row=mysql_fetch_assoc($result)) {
        ?><tr style="white-space:nowrap"><?
        foreach($row as $key=>$value) { ?><td><?=$value?></td><? }
        ?></tr><?
      }
  }
  ?></table><?

?>


edit: msg_type in output
edit2: could we save resources by removing the client name from chatlog table?
« Last Edit: July 29, 2008, 11:58:11 AM by wurst »

Offline xlr8or

  • [ www.xlrstats.com ]
  • Project Lead
  • Hero Member
  • *
  • Posts: 2057
    • The Art of Tactical Gaming
Re: chatlogger plugin v0.0.1
« Reply #3 on: July 29, 2008, 12:01:50 PM »
@tomdesinto: I've set you up a repository for the chatlogger.

Offline Courgette

  • Senior Dev.
  • Hero Member
  • *
  • Posts: 4882
    • Github repository
Re: chatlogger plugin v0.0.1
« Reply #4 on: July 29, 2008, 12:44:33 PM »
@xlr8or: thx again, I'll push the code tonight

edit2: could we save resources by removing the client name from chatlog table?
I think it's interresting to keep track of under what name things were said, as problematic players often use aliasing.

Offline wurst

  • Jr. Member
  • **
  • Posts: 22
Re: chatlogger plugin v0.0.1
« Reply #5 on: July 30, 2008, 03:36:24 PM »
hm je, the alias of the moment when it was said is important.
sure a link to the alias list of that player id could make it perfect then...
playernames get changed afterwards in clients table, if u reconnect with another username and same ip.
i found that out yesterday...

btw, i have the script now with fancy date, a player helped me out after i tryed for hours to change some in the query wit unix date...

here it is:
Code: [Select]
<?php
//wursti shitty klickery
//enter tekst:
$dbhost='host';
$dbusername='user';
$dbuserpass='pw';
$dbname='dbname';
$header='this is the realtime playerchat table';




//connectomatrix.

$db = mysql_connect ($dbhost, $dbusername, $dbuserpass) or die(mysql_error());

//selectomatrix.

mysql_select_db($dbname, $db) or die('Cannot select database');

$query = 'SELECT  ch.`msg_time`, ch.`msg_type`, c.`name`, ch.`msg` FROM `chatlog` as ch INNER JOIN `clients` as c ON ch.`client_id` = c.`id`  ORDER BY `msg_time` DESC LIMIT 0, 500';
$result = mysql_query($query, $db);

if (mysql_errno($db) == 0)
echo "$header <br><br>";
else
 echo mysql_error();
 
//Call table

  ?><table><tr><?
  if(! $result) { ?><th>result not valid</th><? }
  else {
    $i = 0;
    while ($i < mysql_num_fields($result)) {
      $meta = mysql_fetch_field($result, $i);
      ?><th style="white-space:nowrap"><?=$meta->name?></th><?
      $i++;
    }
    ?></tr><?
   
    if(mysql_num_rows($result) == 0) {
      ?><tr><td colspan="<?=mysql_num_fields($result)?>">
      <strong><center>no result</center></strong>
      </td></tr><?
    } else
//      while($row=mysql_fetch_assoc($result)) {
//        ?><tr style="white-space:nowrap"><?
//        foreach($row as $key=>$value) { ?><td><?=$value?></td><? }
//        ?></tr><?
////      }
//  }





while($row = mysql_fetch_assoc($result)) {
        ?><tr style="white-space:nowrap"><?
   foreach($row as $key => $value) {
      if('msg_time' == $key) {
         $value = date("d.m.Y H:i:s", $value);
      }
     
      echo "\t<td>$value</td> ";
   }
}


  ?></table><?

?>

i hope i become faster soon, im expirienced network admin but i never wrote my own php...
what to say? lol wurst n00b.
im planning to bring a link on every chat event that query content around this chat line, so theres possibility to say:
"he admin, heres link to the conversation i mean"

oki gg :D

Offline Stec

  • Full Member
  • ***
  • Posts: 58
    • [83rd]Division Thunderbolts
Re: chatlogger plugin v0.0.1
« Reply #6 on: July 30, 2008, 05:12:52 PM »
@xlr8or: thx again, I'll push the code tonight
I think it's interresting to keep track of under what name things were said, as problematic players often use aliasing.

Most definitely.  Will try your plugin ASAP.

Offline Courgette

  • Senior Dev.
  • Hero Member
  • *
  • Posts: 4882
    • Github repository
Re: chatlogger plugin v0.0.1
« Reply #7 on: July 30, 2008, 05:39:01 PM »
sure a link to the alias list of that player id could make it perfect then...
Not so sure... as it is a acknowledged that alias management with current b3 version can be buggy with certain games (like iourt41).
IMHO it is safer to avoid any dependency with the alias table.

Good luck with your PHP :)

Offline xlr8or

  • [ www.xlrstats.com ]
  • Project Lead
  • Hero Member
  • *
  • Posts: 2057
    • The Art of Tactical Gaming
Re: chatlogger plugin v0.0.1
« Reply #8 on: July 30, 2008, 08:34:20 PM »
Going a tad off topic: Version 1.0.6 of the parser for Urban Terror (iourt41.py) that I pushed today to my repository fixes a few important issues with player synchronization!

v1.0.6 syncs players and handles the events at round end properly. That also affects the tk plugin (cutting points in half at map end) and some stats handling issues.

I am currently testing this parser (it might even fix some alias issues as well).
You can find the parser in this package of B3: http://xlr8or.snt.utwente.nl/hg/b3?ca=e49274e83881;type=zip

edit: make that version 1.0.7, even better syncing and zombie disconnecting - link above is modified!
« Last Edit: July 31, 2008, 12:08:36 AM by xlr8or »

Offline flinkaflenkaflrsk

  • Sr. Member
  • ****
  • Posts: 238
Re: chatlogger plugin v0.0.1
« Reply #9 on: July 30, 2008, 11:49:46 PM »
oh that would be a winner!

Offline Stec

  • Full Member
  • ***
  • Posts: 58
    • [83rd]Division Thunderbolts
Re: chatlogger plugin v0.0.1
« Reply #10 on: July 31, 2008, 11:40:52 AM »
We installed chatlogger plugin on all 3 CoD 4 servers last night and not only was it easy to install but it's working great!  Thanks so much for a stellar effort on this plugin.  Especially helpful is the client name field right there in the chat log table.  It makes it infinitely more useful right away.

Bravo!   ;D

Offline xlr8or

  • [ www.xlrstats.com ]
  • Project Lead
  • Hero Member
  • *
  • Posts: 2057
    • The Art of Tactical Gaming
Re: chatlogger plugin v0.0.1
« Reply #11 on: July 31, 2008, 06:15:17 PM »
For the bold: http://xlr8or.snt.utwente.nl/hg/echelon?ca=tip;type=zip
(latest development snapshot of echelon with chatlog and talkback functionality... warning: could be unstable!)
Check the new configuration... it's done solely by editing: Connections/inc_config.php

Offline magoo

  • Jr. Member
  • **
  • Posts: 11
    • Xtreme Destruction
Re: chatlogger plugin v0.0.1
« Reply #12 on: August 01, 2008, 06:02:23 AM »
What does the "Talkback" function do?

Offline Courgette

  • Senior Dev.
  • Hero Member
  • *
  • Posts: 4882
    • Github repository
Re: chatlogger plugin v0.0.1
« Reply #13 on: August 01, 2008, 10:53:44 AM »
What does the "Talkback" function do?

It allows you to send messages that will show up in the game from Echelon

Offline magoo

  • Jr. Member
  • **
  • Posts: 11
    • Xtreme Destruction
Re: chatlogger plugin v0.0.1
« Reply #14 on: August 01, 2008, 02:51:58 PM »
O.K., Thanks for the information.

 


Rate this page +1 at Google Search

anything