dslinux/user/bitchx/doc/tcl BitchX.tcl crypt-op.bx op-crypt.tcl tcl-commands.doc tcl-ideas
stsp
stsp at user.in-berlin.de
Sun Jul 2 15:18:38 CEST 2006
Update of /cvsroot/dslinux/dslinux/user/bitchx/doc/tcl
In directory antilope:/tmp/cvs-serv9280/doc/tcl
Added Files:
BitchX.tcl crypt-op.bx op-crypt.tcl tcl-commands.doc tcl-ideas
Log Message:
Adding pristine copy of BitchX so I can branch from it.
--- NEW FILE: BitchX.tcl ---
BitchX tcl now includes a special mode similar to what eggdrop bots have. ie
we can setup a BitchX client as both a client and/or a bot.
Client A -----\ /----- Client C
----- Bot A ----------- Bot B -----
Client B -----/ \----- Client D
Bot A and Bot B are both BitchX clients. In Bot A attempts to link in a Bot
link to Bot B then Bot B needs to have Bot A in it's /botlist with a
password. ie /addbot BotA #channel 0 0 password where channel, auto-op and
prot levels don't matter. /clink BotB BotA password is then used to link the
two clients together. From this point on, anything coming over a dcc chat
link or a dcc bot link are passed back and forth over the appropriate links.
Clients dcc chatting with either BotA or BotB will receive information about
joins and parts as well as things the other clients say to one another. BotA
and BotB can also partake in this link as well. The bots in this case should
not try and /dcc chat with anyone. let the Client's attempt the chat.
Commands from Bots
/clink client_to_attempt_link_with
Client_nick_to_link_with password <port>
- attempt to link two clients together in a bot link.
- password can also be /set bot_passwd which bypasses the
Botlist password.
/csay msg
- send msg over all dcc chat links and any bot links as well.
/cwho <bot>
- shows who is on the current bot, or specified bot
/cwhom
- shows who is on every bot.
/cboot [nick] <reason>
- boot nick from the network.
/cmsg [nick> msg
- not fully implemented yet.
Commands for /dcc chat
*note: these are also available in regular dcc chat with someone else. So,
some of these have userlevels applied to them to prevent others from doing
things to you or causing you todo things you wouldnt want them todo.
.act [what] - sends action to chat line
.boot [nick] <msg> - boot nick from network
.chat - once a dcc is started send .chat to enter
the party line
.cmsg [nick] msg - send a privmsg
.echo - toggle echo back to you on/off
.help <topic> - help for commands
.invite nick - invites nick to chat with the host
.msg [nick] [msg] - send a privmsg to someone
.say [msg] - say something on the channel
.quit - quit partyline, but not the chat.
.tcl [tcl_command] - tcl command
.who <botnick> - who is on bot or this bot
.whom - all users on network
Commands for tcl scripting
*note: Most of these follow the eggdrop syntax. Some are unique to BitchX
however. On differance is that instead of a letter for the userlevel, a
numeric userlevel is applied instead.
ircii - causes a ircii command to execute
validuser -
pushmode
flushmode
lvarpop
lempty
lmatch
keyldel
keylget
keylkeys
keylset
maskhost
onchansplit
servers
server_list[i].name, server_list[i].port, server_list[i].connected
chanstruct
c->channel, c->server, c->mode, c->s_mode, c->limit,
c->chop, c->voice, c->channel_create, c->join_time, c->stats_ops,
c->stats_dops, c->stats_bans, c->stats_unbans, c->stats_sops,
c->stats_sdops, c->stats_sbans, c->stats_sunbans, c->stats_topics,
c->stats_kicks, c->stats_pubs, c->stats_parts, c->stats_signoffs,
c->stats_joins, c->set_ainv, c->set_auto_rejoin,
c->set_deop_on_deopflood, c->set_deop_on_kickflood,
c->set_deopflood, c->set_deopflood_time, c->set_hacking,
c->set_kick_on_deopflood, c->set_kick_on_joinflood,
c->set_kick_on_kickflood, c->set_kick_on_nickflood,
c->set_kick_on_pubflood, c->set_kickflood, c->set_kickflood_time,
c->set_nickflood, c->set_nickflood_time, c->set_joinflood,
c->set_joinflood_time, c->set_pubflood, c->set_pubflood_time,
c->set_pubflood_ignore, c->set_userlist, c->set_shitlist, c->set_lamelist,
c->set_kick_if_banned, c->totalnicks, c->maxnicks, c->maxnickstime,
c->totalbans, c->maxbans, c->maxbanstime, c->set_aop, c->bitch_mode);
channel
channels
isop
getchanhost
matchattr
finduser
findbot
findshit
date
time
ctime
dccstats
dccnum,
read,
dcc_types[flags&DCC_TYPES],
user,
status DCC_DELETE ? "Closed" :
DCC_ACTIVE ? "Active" :
DCC_WAIT ? "Waiting" :
DCC_OFFER ? "Offered" : "Unknown",
starttime.tv_sec,
filesize,
bytes_sent,
bytes_read,
filesize,
description,
encrypt or ""
onchan
chanlist
unixtime
putlog
putloglev
rand
timer
killtimer
utimer
killutimer
timers
utimers
putserv
putscr
putdcc
putbot
putallbots
bind
binds
unbind
strftime
cparse
userhost - Attempt to find nick on irc. Any number of nicks
may be specified.
getchanmode
Tcl variables BitchX sets.
botnick
nick
realname
username
server
version
curchan
userhost - variable is set in response to the userhost command
un-userhost - variable is set in response to the userhost command
Special considerations.
tcl bind raw functions that return 1 will bypass the internal ircII
routines. returning 0 or nothing will have the tcl and the ircII internal
routine execute.
BitchX's bot mode acts very similar to eggdrop's and in fact thanks to Robey
for defining the protocol necessary to achieve this.
--- NEW FILE: crypt-op.bx ---
#power at power.zepa.net
#replace key1 and key2 with this keys you set on force1 by .crypt key1 key2
on #-msg 44 " * " {
if ([$0]==[force1]&&[$1]==[crypt_op]) {
echo $G crypt_op request from $0... sending op strings.
^msg $0 crypt_reply $encrypt(key2 $decrypt(key1 $2))
}
}
--- NEW FILE: tcl-commands.doc ---
This is an exhaustive list of all the Tcl commands added to eggdrop. All
of the normal Tcl built-in commands are still there, of course. But you
can also use these to manipulate features of the bot. They are listed
according to category.
NOTICE: Quite a lot has changed in the transition to v1.0!
SCRIPTS WHICH WERE WRITTEN FOR v0.9 WILL PROBABLY NOT WORK WITHOUT SERIOUS
MODIFICATION. To help along the transition to v1.0 scripts, I have marked
the changed commands (and new ones) by putting vertical bars to the left.
Anything that uses those commands will need to be changed for v1.0.
*** OUTPUT COMMANDS ***
putserv <text>
sends text to the server, like 'dump' (intended for direct server
commands)
returns: nothing
[...981 lines suppressed...]
will be called with blank text (the input-text will be ""). This
is the only time it will ever be called with "" as the text, and it
is the last time your proc will be called for that connection.
If you want to hand control of your connection back to eggdrop, your
proc should return 1. Otherwise, return 0 to retain control.
(C) MATCH CHARACTERS
Many of the bindings allow match characters in the arguments. Here
are the four special characters:
? matches any single character
* matches 0 or more characters of any type
% matches 0 or more non-space characters (can be used to match a
single word)
~ matches 1 or more space characters (can be used for whitespace
between words)
--- NEW FILE: op-crypt.tcl ---
if {![info exists blowfish_version]} {
putscr "You MUST load the blowfish encryption module prior to loading this!"
return 0
}
set crypt_timeout 60
#borrowed from alltools.tcl
proc randstring {count} {
set rs ""
for {set j 0} {$j < $count} {incr j} {
set x [rand 62]
append rs [string range "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" $x $x]
}
unset x
unset j
return $rs
}
proc crop {n args} {
global cryptkeeper cryptlist crypt_timeout
if [onchan $n [_T]] {
if {![info exists cryptkeeper([string tolower $n])]} {
putscr "You must first set a pair of crypt keys before using this."
putscr "Try /addcrypt <nick> <key1> <key2>"
return 0
}
putserv "privmsg $n :crypt_op"
set cryptlist([string tolower $n]) [utimer $crypt_timeout "unset cryptlist([string tolower $n])"]
}
return 0
}
bind msg -1 crypt_op crypt_response
proc crypt_response {n u h a} {
global cryptkeeper cryptlist
if {![info exists cryptlist([string tolower $n])]} {
putscr "$n requesting UNAUTHORIZED crypt verification!"
return 1
} {
unset cryptlist([string tolower $n])
putserv "privmsg $n :crypt_reply [encrypt [lindex $cryptkeeper([string tolower $n]) 1] [decrypt [lindex $cryptkeeper([string tolower $n]) 0] $a]]"
}
return 1
}
proc addcrypt {n k1 k2 args} {
global cryptkeeper
set cryptkeeper([string tolower $n]) "$k1 $k2"
putscr "Added $n to the crypt keeper with keys $k1 and $k2."
}
return 0
--- NEW FILE: tcl-ideas ---
<jEkS> isban <ban> [channel]
<jEkS> matchban <nick!user at host> [channel]
<jEkS> isvoice <nickname> <channel>
<jEkS> onchan <nickname> <channel>
<jEkS> chanbans <channel>
<jEkS> getchanhost <nickname> <channel>
<jEkS> onchansplit <nick> <channel>
<jEkS> chanlist <channel>
<jEkS> getchanmode <channel>
<jEkS> maskhost <nick!user at host>
<jEkS> ctime <unixtime>
[Jeks(dcc)] .tcl return [expr 1 + 1]
<jEkS> :/set bot_tcl_command 1/0
ForChannelOps #channel -minlevel -maxlevel command
ForChannelNOps #channel -minlevel -maxlevel command
inAway (if your away return 1)
[noob(dcc)] this is how the raw server data is handles
[noob(dcc)] and if the raw numeric is specified
[noob(dcc)] i.e.
[noob(dcc)] proc RAW_KICK { level } \
[noob(dcc)] {
[noob(dcc)] Echo [TopChannel] "blah" \[\04FunScript\04\]
[noob(dcc)] }
[noob(dcc)] proc RAW_303 { level } \
[noob(dcc)] {
[noob(dcc)] Echo "this that the other thing" blah
[noob(dcc)] }
[noob(dcc)] then when the server replys a 303
[noob(dcc)] /echo (blue)blah(blue) this that the other thing
[noob(dcc)] via proc name
[noob(dcc)] TCL's sockets are shitty
[noob(dcc)] SockCreate socketname function blah blah
[noob(dcc)] proc PARTY {} \
[noob(dcc)] {
[noob(dcc)] set nErrCode [catch {SockCreate party "party " 1093 1 13}]
[noob(dcc)] if { $nErrCode == 0 } \
[noob(dcc)] {
[noob(dcc)] global party
[noob(dcc)] set party "ON"
[noob(dcc)] Echo [MyNick] "Partyline Socket created..." PARTY!
[noob(dcc)] SockListen party 3
[noob(dcc)] if { $nErrCode != 0 } \
[noob(dcc)] {
[noob(dcc)] Echo [MyNick] "Can't listen with socket party" PARTY!
[noob(dcc)] } else \
[noob(dcc)] {
[noob(dcc)] Echo [MyNick] "Partyline now active with socket party. To
disable
type /noparty" PARTY!
[noob(dcc)] }
[noob(dcc)] }
[noob(dcc)] } else \
[noob(dcc)] {
[noob(dcc)] Echo [MyNick] "Can't create socket" PARTY!
[noob(dcc)] }
[noob(dcc)] Complete
[noob(dcc)] }
[noob(dcc)] as u see... an alias is proc NAME(all caps)
[noob(dcc)] it will listen to a socket at port 1093
[noob(dcc)] if its able to create the socket sucsessfully it returns a 1
[noob(dcc)] i mean it sets nerrcode to 0
[noob(dcc)] otherwise it says cant listen with socket
[noob(dcc)] and when u type /pass
[noob(dcc)] it exicutes that proc
[noob(dcc)] and u are then listening to port 1093
[noob(dcc)] and the socket name is party
[noob(dcc)] for every connection u would need this...
[noob(dcc)] a onACCEPT
[noob(dcc)] proc onACCEPT_party { name nErrCode } \
[noob(dcc)] {
[noob(dcc)] global last
[noob(dcc)] set last ""
[noob(dcc)] global user
[noob(dcc)] incr user
[noob(dcc)] global user_$user
[noob(dcc)] set user_$user "1"
[noob(dcc)] set $name party
[noob(dcc)] Echo [MyNick] "hmm $name connected to partyline server1"
[noob(dcc)] SockAccept "user_$user" $name
[noob(dcc)] if { $nErrCode != 0} { Echo [MyNick] "Problem with SockAccept "
}
[noob(dcc)] Echo [MyNick] "\01A new user joined the partyline. This is user
$user\01"
[noob(dcc)] PostMsg "PAR user_$user@[SockRemoteIP $name] joined the
partyline!"
[noob(dcc)] SockSendT user_$user "\04Current commands are:\n"
[noob(dcc)] SockSendT user_$user ".\02me\02 <text> - action on
partyline\n"
[noob(dcc)] SockSendT user_$user ".\02nick\02 <nick> - change
partyline ID\n"
[noob(dcc)] SockSendT user_$user ".\02quit\02 <reason> - left on
partyline\n"
[noob(dcc)] SockSendT user_$user ".\02MSG\02 <nick> <text> - Sends a
msg to nick\n"
[noob(dcc)] SockSendT user_$user ".\02WHOM\02 - Tells you who is
connected\n"
[noob(dcc)] SockSendT user_$user ".\02DIE\02 <pass> - Kills the
partyline\n"
[noob(dcc)] SockSendT user_$user ".\02PING\02 - Checks for lag\n"
[noob(dcc)] SockSendT user_$user ".\02BOOT\02 <pass> <nick> - Kicks
a
nick off the partyline\n"
[noob(dcc)] SockSendT user_$user "*** \04if u have more command
ideas
try \02noob at america.com\02\04 *** \n"
[noob(dcc)] SockSendT user_$user "If you want to exit... Type .quit
reason to quit. Type .help for all commands. \n"
[noob(dcc)] SockSendT user_$user "\02Type \".nick <NewNick>\", Must
be
within 9 letters.\n"
[noob(dcc)] Complete
[noob(dcc)] }
[noob(dcc)] that changes the sepcific's socket to its own socketname
[noob(dcc)] that way u can have more then 1 connection at your port
[noob(dcc)] and a SockClose
[noob(dcc)] and a SockCloseAll
[noob(dcc)] will be needed
[noob(dcc)] a [SockLine $name] would be the last text recieved from socket
$name
[_jeks_(~jeks at msiw34.msi.se)] then you should check out
ftp://ftp.neosoft.com/pub/tcl/NEW there is a file called
tcl7.5p1plus.patch.gz .. use that..
[_jeks_(~jeks at msiw34.msi.se)] then you can add a Tcl_InitIndependant (or
sumthing) to make the bin completly independant from any tcl libs
installed on the system..
[_jeks_(~jeks at msiw34.msi.se)] great if you want to make a bin distrib.. then
it doesn't care wether tcl is installed or not..
you could mail liotta at hotmail.com ..!
2. kwak (Sep 25 23:42): abnout the [ircii args] function, I
think I need it to send to the tcl interpreter instead of the
screen, or maybe there should be a parameter to it.. like [ircii
-console args] to put it to screen.. Cause If I need a var it can't
be done.. like "/tcl set ircii-setlist [ircii set] it only puts to
screen not to the var.. it is very important that it does.
3. kwak (Sep 25 23:43): cause then you can put some params from
ircii to the tcl.. like "/tcl set color1 [ircii eval echo ${C1}] or
whatever..
More information about the dslinux-commit
mailing list