There are quite a few flaws in that code:
1. You iterate through all members of a channel, doing that check; but each time you overwrite the result of the previous test.. Unless you use $h further down inside that foreach-loop, that would not make sense
2. You are mixing lists and string commands; this is a BIG no-do. If you wish to use list-commands, you'll have to convert the string to a list, using commands such as "list" or "split".
If you wish to isolate the hostname part from nick!ident@hostname, I'd suggest something like this:
Code: Select all
...
set userhost [getchanhost $user $chan]
if {[string match "*.users.undernet.org" $userhost]} {
set h [lindex [split $userhost "@"] end]
} ...
Of course, you'd still have to do something useful with $h before you close the foreach-loop...
edit: Removed an accidental space between $ and userhost in the example-code