An example of how it can be done.simonbell wrote:ok yes i know the specific numeric replies, what i mean is, at present im telling the bind to catch raw 303, if i wanted to catch more than one bind numeric, and output the results as one list inside one proc, how can it be done?
Simon
# End of userinfoproc msg_userinfo {nick uhost hand arg} {
set nick_requested [lindex $arg 0]
putserv "ISON $nick $nick_requested"
}
proc rawnickinfo {from keyw arg} {
set reqwithcolon [lindex $arg 1]
set reqnick [lindex $arg 2]
set req [string range $reqwithcolon 1 end]
if { $reqnick == "" } {
putnotc $req "Error: User with that nick is offline"
return 0
}
putserv "WHOIS $reqnick"
set userinfoarray("$reqnick") "[unixtime] $req"
}
proc rawwhoisuser {from keyw arg} {
global userinfoarray
set whoisusernick [lindex $arg 1]
if { [array exists $whoisusernick] == 1 } {
set whoisuseruser [lindex $arg 2]
set whoisuserhost [lindex $arg 3]
set whoisuseruhost "$whoisuseruser@$whoisuserhost"
set whoisuserhand [finduser $whoisusernick!$whoisuseruser@$whoisuserhost]
set userinfoarray($whoisusernick) "Nick: $whoisusernick"
set userinfoarray($whoisusernick) "Address: $whoisuseruhost"
if { $whoisuserhand != "*" } {
set whoisuserinfo [getuser $whoisuserhand INFO]
if { ($whoisuserinfo != "") || ($whoisuserinfo != "*") } {
set userinfoarray($whoisusernick) "Info: $whoisuserinfo"
}
}
}
}
proc rawmodes {from keyw arg} {
global userinfoarray
set rawmodenick [lindex $arg 1]
if { [array exists $rawmodenick] == 1 } {
set rawmodemode [lindex $arg 5]
set userinfoarray($rawmodenick) "Modes: $rawmodemoe"
}
}
proc rawwhoisserver {from keyw arg} {
global userinfoarray
set rawservernick [lindex $arg 1]
if { [array exists $rawservernick] == 1 } {
set rawserverserver [lindex $arg 2]
set userinfoarray($rawservernick) "Server: $rawserverserver"
}
}
proc rawwhoischans {from keyw arg} {
global userinfoarray
set rawchannick [lindex $arg 1]
if { [array exists $rawchannick] == 1 } {
set rawchanchans [lrange $arg 2 end]
set userinfoarray($rawchannick) "Channels: $rawchanchans"
}
}
proc rawendofwhois {from keyw arg} {
global userinfoarray
set rawendnick [lindex $arg 1]
if { [array exists $rawendnick] == 1 } {
putlog "$userinfoarray($rawendnick)"
}
}
command, and this does output the names in the array. However, if i try this in the next part of the script, it does not do anything, but i know its reaching this part of the script by putting a putlog "test" just above the command to retrieve the array.array names arrayname
and this part is not:proc rawnickinfo {from keyw arg} {
set reqwithcolon [lindex $arg 1]
set reqnick [lindex $arg 2]
set req [string range $reqwithcolon 1 end]
if { $reqnick == "" } {
putnotc $req "Error: User with that nick is offline"
return 0
}
putserv "WHOIS $reqnick"
set userinfoarray("$reqnick") "[unixtime] $req"
}
i think that when i set the array in the first proc is isnt becoming global, or when i do "global userinfoarray" in the 2nd proc, ive done something wrong. As far as i can see when looking at the SUNiNET tcl tutorials ive done it correctly so im at a bit of a dead end.proc rawwhoisuser {from keyw arg} {
global userinfoarray
set whoisusernick [lindex $arg 1]
if { [array exists $whoisusernick] == 1 } {
etc
i get the following output:foreach chanout $chanremrbrak {
putnotc $userreqnick "Listing channels that $rawendnick is on:"
putnotc $userreqnick "$chanout"
putnotc $userreqnick "End of user info"
}
So, the question is, how can i get the bot to wait for the last channel to be listed before outputting "End of user info"-H4- Listing channels that bob is on:
-H4- @#MillsNet
-H4- End of user info
-H4- *#TheLight
When the person is not in a channel, the bind is not triggered at all. Is there a different raw numeric when doing a whois on someone who is not in a channel or something?bind raw - 319 rawendofwhois
proc rawendofwhois {from keyw arg} {
putlog "test"
}
You will need to check RFC 1459 for the numerics. 319 is a different reply from 318simonbell wrote:... another small problem... Ive narrowed this down to the endofwhois raw bind using:
Code: Select all
bind raw - 319 rawendofwhois proc rawendofwhois {from keyw arg} { putlog "test" }