all TCL commands that start with the letter l are list commands, except "load" and possibly some module commands. basicly all lists are are just strings, but by calling it a list, it interprets {} and " as signalling the beginning and end of parts of the list. for example:
{ "something" "something else" }
in the literal sense, this is a string, because it is just ascii characters, 8 bits each. but taken in the context of a list...is much more usefull
.
using your old code:
Code: Select all
proc reslove:raw {from key arg} {
global botnick
set bothost [join [lrange $arg 0 end]]
set sbothost [lindex [split $bothost @] 1]
set nslookup [dnslookup $sbothost reslove:ipaddress]
}
$arg is a string, and is treated as a single object. no matter what is contained in that string, TCL doesn't care, doesn't even look at it. but by using lrange (list range), the TCL interpreter forces the string into a list structure. so if (for example) you had: "{\/}y name is Bot" in the realname field of the whois reply, you bot would puke. it would try to interpret all of the special chars in that string as special chars...instead of just treating the whole thing as one object, and each char as just an anonymous 8 bits.
if you are wanting to use the string as a list, however, you need to [split $arg]. this escapes all the special characters in the original string, and adds new special characters to form a list.
"{\/}y name is Bot" -> { "\{\\/\}y" "name" "is" "Bot" }
in any case, even with a properly formated list, [lrange $list 0 end] does absolutely nothing
I'm thinking all you need for that proc is:
Code: Select all
proc reslove:raw {from key arg} {
set bothost [lindex [split $arg @] 1]
set nslookup [dnslookup $sbothost reslove:ipaddress]
}
(of course, you could skip the bothost var all togeather, but wanted to make sure things are clear
hope this helps
roland