Previous
Next
Table of Contents
6. TCL Script
Tcl is one of much scripting language. It's better than most "in-built"
script languages (like the one in ircII). So I linked it with keirc.
Here ist a list of the commands added to Tcl by keirc.
SEND COMMAND TO SERVER
sendraw [text]
sends text to the server, e.g sendraw "PRIVMSG #lesehan :Hallo"
Text will not be parsed by keirc.
returns: nothing
sendserver [text]
sends text to the server, e.g sendserver "PRIVMSG #lesehan Hallo"
Text will be parsed first by keirc.
returns: nothing
sendmsg [user] [text]
sends text to the 'user'
returns: nothing
sendnotice [to] [text]
sends text to the 'to'
returns: nothing
sendchannel [channel] [text]
sends text to the channel 'channel'
returns: nothing
sendctcp [user] [text]
sends ctcp to the user 'user'
returns: nothing
sendctcpreply [user] [text]
sends ctcpreply to the user 'user'
returns: nothing
sendmode [to] [arg]
sends mode to 'to' with argument 'arg'
returns: nothing
sendcmd [arg]
sends cmd arg to keirc client. The command
will be parsed first and the sent to server.
returns: nothing
OUTPUT COMMANDS TO WINDOW
writewnd [flag] [text] [filter], filter=1 or 0
write text to server-message window
flag: see flag
filter: 1, text will be converted to html tag by keirc
returns: nothing
writeactive [flag] [text] [filter], filter=1 or 0
write text to active window
flag: see flag
filter: 1, text will be converted to html tag by keirc
returns: nothing
writepage [name] [flag] [text] [filter], filter=1 or 0
write text to output page with name 'name' created by addpage
flag: see flag
filter: 1, text will be converted to html tag by keirc
returns: nothing
flag:
TYPE_MSG 1
TYPE_TEXT 2
TYPE_ERROR 4
TYPE_INFO 8
TYPE_ACTION 16
TYPE_NOTICE 128
TYPE_RAW 2048
addpage [name]
create new output page with name 'name'
since kEirc 3.0 detach-flag will not be used anymore
returns: name of created output page
delpage [name]
destroy output page with name 'name' created by addpage
returns: nothing
COMMANDS TO HANDLE USERLIST
addfriend user level [channel]
add user to friendlist
returns: nothings
delfriend user
del user from friendlist
returns: nothings
addban user level [channel]
add user to banlist
returns: nothings
delban user
del user from banlist
returns: nothings
addignore user flag [seconds]
add user to ignorelist
flag : pcntf, p=private msg, c=channel, n=notify, t=dcc chat, f=dcc send
seconds how long user will be ignored
returns: nothings
delignore user
del user from ignorelist
returns: nothings
friendlevel user [channel]
returns: friendlevel of user in friendlist
banlevel user [channel]
returns: banlevel of user in banlist
isignore user flag
flag : pcntf
returns: if user is found in the ignorelist with flag 'flag', 1 is returned.
addchanban user channel [seconds]
if you have op, then ban user on channel 'channel' for 'seconds' second
returns: nothings
OTHER COMMANDS
sleep [seconds]
like unix-sleep
returns: nothing
nick
returns: keirc current nick
server
returns: keirc current server e.g "irc.dal.net 6667"
userinfo [nick]
find user info for user nick 'nick'
returns: on succeed : string of user info, e.g "nick host server ircname"
on failed : empty string
userhost [nick]
find hostname for user nick 'nick'
returns: on succeed: hostname
on failed : empty string
userserver [nick]
find serverhost, where user nick 'nick' connect to
returns: on succeed: serverhost
on failed : empty string
userlist [channel]
find userlist on the channel "channel"
returns: on succeed: list of nick on channel
on failed : empty string
chanlist
find channels we are join to
returns: on succeed: list of channel
on failed : empty string
haveop [nick] [channel]
find out if nick on channel "channel" has op
returns: "1" if yes
"0" if no
kexec program_inc._args [flags] [proc]
program_inc._args: programm name inclusive arguments, e.g "ls -l"
flags: out, err, exit
proc: procedure, that will be called if event defined in flags occured.
The program with argument args will be executed. If flags is defined, then the proc
will be called if event defined in flags occured.
proc [flag] [output text]
returns: handle of process
kkill handle
process with handle 'handle' will be killed.
returns: nothing
addtimer flag second proc
flag: - single shot, it means after "second" seconds proc will be called only one time
+ proc will be called for all "second" seconds
returns: time_handle
deltimer time_handle
timer with handle time_handle will be removed from the list.
returns: nothing
deltimer flag second proc
remove all timers matching to arguments "flag second proc".
second and proc can be regular expression
returns: nothing
MISCELLANEOUS COMMANDS
bind [type] [command-name] [proc-name]
flags will not be used anymore in the keirc 0.2.
adds a new keyword command to keirc, valid types are listed below; the
the [command-name] for each type is listed below; [proc-name] is the name
of the Tcl procedure to call for this command (see below for the format
of the procedure call)
returns: name of the command that was added
unbind [type] [command-name] [proc-name]
removes a previously-made binding
returns: name of the command that was removed
setopt [var] [value]
set Option-Variable "var" with new value "value"
returns: value
getopt [var]
find the value of optionsvariable "var"
returns: value of the variable "var"
BIND/UNBIND COMMAND EXTENSION
You can use the 'bind' command to attach Tcl procedures to certain events.
For example, you can write a Tcl procedure that gets called every time a
user says "danger" on the channel. The following is a list of the types of
bindings, and how they work. Under each binding type is the format of the
bind command, the list of arguments sent to the Tcl proc, and an explanation.
In the keirc 0.2 the flags will not be used, and TIMER-type is removed.
There is new command addtimer and deltimer to handle timer event.
Some bindings are marked as "TCL first". That means that Tcl procedure
are called first, before the default routine ist being called. "Routine
first" means that default routine called first.
You can bind single command to multiprocedure, it means several procedures
can be called only for one command.
All commands will be matched with wildcard, and called one after another.
To remove a binding, just unbind to the proc. For example, to remove
a binding for the MSG-command "stop", use "unbind msg stop proc".
If you want to delete a binding of all procedures for one command, you can
use wildcard "*" as procedure.
For example, "unbind msg stop *" will delete binding for all procedures
from command stop.
(1) MSG TCL first
bind msg [command] [proc]
procname [nick] [to] [nick!user@host] [args]
used for /msg commands; the first word of the user's msg is the command,
and everything else becomes the argument string
(2) CHANMSG TCL first
bind chanmsg [mask] [proc]
procname [nick] [channel] [nick!user@host] [text]
matches the entire line of text said on channel with the mask;
(3) PRIVMSG TCL first
bind privmsg [mask] [proc]
procname [nick] [to] [nick!user@host] [text]
matches the entire line of text from a /msg with the mask;
(4) DCC TCL first
bind dcc [command] [proc]
procname [nick] [cmd] [nick!user@host] [args]
cmd ist cmd for DCC(chat, send...)
If procedure returns 1, the built-in routine is not
being called.
(5) JOIN Routine first
bind join [nick!user@host] [proc]
procname [nick] [channel] [nick!user@host]
triggered by someone joining the channel; the [nick!user@host] in the
bind can contain wildcards
(6) PART Routine first
bind part [nick!user@host] [proc]
procname [nick] [channel] [nick!user@host]
triggered by someone leaving the channel; as in JOIN, the [nick!user@host]
can contain wildcards
(7) TOPIC Routine first
bind topc [topic] [proc]
procname [nick] [channel] [nick!user@host] [topic]
triggered by a topic change; can use wildcards
(8) KICK TCL first
bind kick [kicked-nick] [proc]
procname [nick] [kicked-nick] [nick!user@host] [reason]
triggered when someone is kicked off the channel; the binding goes by
the nickname of the person kicked off (can use wildcards);
(9) NICK Routine first
bind nick [newnick] [proc]
procname [nick] [newnick] [nick!user@host]
triggered when someone changes nicknames; wildcards are allowed
(10) MODE Routine first
bind mode [mode-change] [proc]
proc-name [nick] [to] [nick!user@host] [mode-change] [args]
mode changes are broken down into their component parts before being
sent here, so the mode-change will always be a single mode, like "+m"
or "-o snowbot";
to can be channelname or your nickname
(11) CTCP TCL first [Except VERSION, PING]
bind ctcp [keyword-mask] [proc]
proc-name [nick] [to] [nick!user@host] [keyword] [args...]
"to" will be a keirc-nickname or a channel name
keyword is the ctcp command and args may be empty
If procedure returns 1, the built-in routine is not
being called.
(12) CTCR Routine first
bind ctcr [keyword] [proc]
proc-name [nick] [to] [nick!user@host] [keyword] [args...]
just like ctcp, but this is triggered for a ctcp-reply
to ist keirc-nickname
(13) FLOOD
bind flood [mask flag] [proc]
proc-name [nick] [flag] [nick!user@host] [channel]
mask flag : pc, p=private msg, c=channel
flag: p or c,
if flag=c , then channel will be added as argument
SETOPT/GETOPT COMMAND EXTENSION
You can change the value of Option Preference by keirc
with setopt. For now is not all Option Preferences supported
yet. You can retrieve the value with command getopt.
Hier are the option-preference, you can manipulate
(1) STARTCONFIG
variable value, this var can retrieve
AutoConnect Yes
No
AutoChangeNick Yes
No
AutoReconnect Yes
No
StartActionDelay number > 1 [in seconds]
ReconnectionDelay number > 1 [in seconds]
IsonDelay number > 1 [in seconds]
(2) PRIVATEMSG
variable value, this var can retrieve
OnPrivMsg AutoAccept
Ignore
Dialog
PrivMsgClientMax number > 0
PrivMsgDlgMax number > 0
PrivMsgDlgTimeout number > 0 [in seconds]
(3) CHANNELINVITE
variable value, this var can retrieve
OnChannelInvite AutoAccept
Ignore
Dialog
InvDlgMax number > 0
InvDlgTimeout number > 0 [in seconds]
(4) CHANNELKICK
variable value, this var can retrieve
OnChannelKick AutoJoin
Quiet
Dialog
KickDlgTimeout number > 0 [in seconds]
(5) DCCCHAT
variable value, this var can retrieve
OnDCCChat AutoAccept
Ignore
Dialog
DCCChatClientMax number > 0
DCCChatDlgMax number > 0
DCCChatDlgTimeout number > 0 [in seconds]
DCCChatTimeout number > 0 [in seconds]
(5) DCCFile
variable value, this var can retrieve
OnDCCFile AutoAccept
Ignore
Dialog
DCCFileClientMax number > 0
DCCFileDlgMax number > 0
DCCFileDlgTimeout number > 0 [in seconds]
DCCSendTimeout number > 0 [in seconds]
OnFinishedBeep Yes
No
OnFinishedCloseWindow Yes
No
DCCSendBlock 1024
2048
3072
4096
DCCFileDir valid directory
(5) CTCPSound
variable value, this var can retrieve
OnCTCPSound AutoAccept
Ignore
Dialog
OnCTCPSoundOnPlay Always
Wait
Dontplay
CTCPSoundDir valid directory
Previous
Next
Table of Contents