shroudBNC Board

Full Version: log.tcl
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This tutorial is outdated. Current script version does not match tutorial.

The following was originally posted by doomie on Sun, 22 January 2006 00:04 in old shroudBNC boards

This tutorial is supposed to explain how log.tcl and all its options work.
NOTE: This script is still beta. You can get it at http://wiki.shroudbnc.info/en/1.2/userscripts/log.tcl
Don't expect it to work 100%. Please report all bugs as reply to this post.
NOTE: This script will only log while you are offline.
If you want to log while you are online too, you would have to do following:
Code:
/sbnc tcl :setbncuser <your username> tag log_always 1
/sbnc tcl :log:internalbind <your username>

This is no official setting.

General settings

At the begin of the file, there is a socalled "settings-area", in which you can change following default settings:

timestamp - this is the standard timestamp and only be used if the user doesn't specify one himself. Look at http://www.astro.princeton.edu/~rhl/Tcl-...l/clock.n. html to get a view over the format.

maxlines - this is the maximum number of lines one user is allowed to log per channel. It will only used if an admin doesn't set another value (see below). If set to "off", every user can log infinite lines.

maxchannels - this is the maximum number of channels a user is allowed to log. If set to "off", every user can log as much channels as he wants to.

allow - if this is set to 1, every user can log by default, if set to 0, it has to be allowed by an admin (see below).

endofline - "\n" is the default for linux, "\r\n" default for windows to make the files itself readable. However, you can specify everything as seperator, but make sure it's not used in a normal PRIVMSG.

Commands

All commands handled in the next chapters has to be used like:
Code:
/sbnc chanlogs <command> <parameters>
or
Code:
/msg -sBNC chanlogs <command> <parameters>


The next chapter will handle all admin-only commands:

Admin commands

allow <user> <1|0> - allows an user to log or not.

maxchannels <user> <number of channels> - sets the number of channels a user is allowed to log. If the user is currently logging more channels, his list will be cut down.

maxlines <user> <number> - sets the number of lines a user is allowed to log.

usersettings <user> - shows all settings of this user.


User commands

add <#channel|all> - adds #channel to the list of logged channels. If "all" is specified, it is set to log all channels you are in. It will return an error message if adding isn't possible (if already "maxchannels" will be logged"

del <#channel|all> - deleted #channel from the list of logged channels or deletes all channels.

enable - enables logging.

disable - disables logging.

autodelete <on|off> - if turned on, logs will be deleted after played on connect (see below).

lines <X|all> - sets the number of lines that will be logged. If set to all, all PRIVMSG's will get logged, else it will be cycled. Logging "all" does only work if the user is allowed to log everything, else it will be set to the number of lines the user is allowed to log.

onconnect <X|all|off> - if set to all, all lines received after your last detach (disconnect from the BNC) will be played on connect, either as "normal reply", as raw or as channel message (see reply below), else the last X lines will be played. If set to off, nothing will be played.

timestamp <timestamp|off> - this allows the user to set an own timestamp. It has to be a valid format (see http://www.astro.princeton.edu/~rhl/Tcl-...l/clock.n. html). If set to off, the default timestamp will be used.

play <#channel> [last|X|from-to] - this will either play the entire channenlog of #channel (if no parameter specified), or everything since the last detach (last), the last X lines (X), or all lines from "from" to "to". Valid expressions are:
Code:
play #channel 10-

will play everything from line 10 on


Code:
play #channel -10

will play everything from line 1 to 10


Code:
play #channel 10-20

will play everything from line 10 to line 20

delete <#channel|all> - will delete the logfile of #channel or all log files.

search <#channel|all> <mask> - this will search in the logfile of #channel (or all log files) for a line matching <mask>. Example:
search all *moo*

This would return all lines containing "moo".

settings - shows all settings (not including admin-only settings)

reply <off|chan|X> - this defines how sBNC is supposed to send logfiles onconnect only (everything else will be send as "normal reply"). If set to "off", it will be played in your -sBNC window, if set to "chan", you will get it as normal channel message, as if it was just said, if set to "X", you will get a raw in the following format:
Code:
:<server> sbnc <X> <your nickname> <timestamp in unix format> <channel> <address of the user who did say something> :<message of this user>


A mIRC script that would be able to bring this into a "nice" format is:
Code:
raw *:*: {
  if ($event == sbnc) {
    if ($1 == 100) {
      echo $4 $chr(91) $+ $asctime($3,HH:nn:ss) $+ $chr(93) < $+ $gettok($5,1,33) $+ > $6-
      haltdef
    }
  }
}

You would have to put this into a new remote file.


First steps
The last part is supposed to give a little "how-to" activate logging (what options has to be set to what):

If you, as admin, want to log everything, you would have to set the following options:

Code:
/sbnc chanlogs allow <your username> 1
/sbnc chanlogs maxlines <your username> off
/sbnc chanlogs maxchannels <your username> off
/sbnc chanlogs enable
/sbnc chanlogs lines all
/sbnc chanlogs add all

So everything that will be said while you are detached will be logged.


doomie
This tutorial is outdated. Current script version does not match tutorial.
Reference URL's