This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.
For more information, see this announcement post . Click the X in the top right-corner of this box to dismiss this message.
Help for those learning Tcl or writing their own scripts.
WazzaUK
Voice
Posts: 19 Joined: Sun Jul 02, 2006 5:03 pm
Post
by WazzaUK » Sun Sep 10, 2006 5:36 pm
im trying to set a field in a MYSQL table when users are in a particular channel ('yes' when join, 'no' when part). Join works fine, but part doesnt even seem to call the procedure. Ive gotta be missing something..
Any ideas.....
Code: Select all
load /usr/local/lib/mysqltcl-3.02/libmysqltcl3.02.so
package require mysqltcl
set db_handle [mysqlconnect -host ###.###.###.### -socket /var/lib/mysql/mysql.sock -user <user> -password <password> -db <database>
bind join - "#channel *" join_main
bind part - "#channel *" part_main
proc join_main {nick uhost hand channel} {
global db_handle botnick
if {$nick==$botnick} {return 0}
set sql "UPDATE users SET onirc = 'yes' WHERE username = '$nick'"
putloglev d * "ircstats: executing $sql"
set result [mysqlexec $db_handle $sql]
if {$result != 1} {
putlog "SQL - error"
} else {
set id [mysqlinsertid $db_handle]
puthelp "PRIVMSG $channel :User Online \002$nick\002 added"
}
}
proc part_main {nick uhost hand channel} {
global db_handle botnick
if {$nick==$botnick} {return 0}
set sql "UPDATE users SET onirc = 'no' WHERE username = '$nick'"
putloglev d * "ircstats: executing $sql"
set result [mysqlexec $db_handle $sql]
if {$result != 1} {
putlog "SQL - Error"
} else {
set id [mysqlinsertid $db_handle]
puthelp "PRIVMSG $channel :User Offline \002$nick\002 removed"
}
}
WazzaUK
Voice
Posts: 19 Joined: Sun Jul 02, 2006 5:03 pm
Post
by WazzaUK » Sun Sep 10, 2006 6:00 pm
i forgot a msg param in part procedure
WazzaUK
Voice
Posts: 19 Joined: Sun Jul 02, 2006 5:03 pm
Post
by WazzaUK » Sun Sep 10, 2006 7:27 pm
seems that part doesnt cover quit and pingtime out - any ideas???
nml375
Revered One
Posts: 2860 Joined: Fri Aug 04, 2006 2:09 pm
Post
by nml375 » Sun Sep 10, 2006 7:59 pm
Yup, quit is a completely separate (irc) command from part..
Hence it got its own binding, "sign":
bind sign <flags> <mask> <proc>
procname <nick> <user@host> <handle> <channel> <reason>
Description: triggered by a signoff, or possibly by someone who got
netsplit and never returned. The signoff message is the last
argument to the proc. Wildcards can be used in the mask, which is
matched against '#channel nick!user@host'.
NML_375
WazzaUK
Voice
Posts: 19 Joined: Sun Jul 02, 2006 5:03 pm
Post
by WazzaUK » Mon Sep 11, 2006 2:22 am
yep sign covered quit/ping timeout
what about nick change - is there a list of these procedures anywhere?
got it lol
bind nick <flags> <mask> <proc> procname <nick> <user@host> <handle> <channel> <newnick>
Stackable
Triggered when someone changes nicknames. Wildcards are allowed. The mask is matched against #channel newnick.