Recently, while making a script that accesses /who raw data, I have discovered that you can't reliably /who $nick to get the results you are looking for. Example:
If you do
/who frank, the server will reply with all the users who have frank as their nick, ident, or realname. The simplest reliable method I've found is to use the /userhost $nick command.
Here is my code that parses RAW 302 (/userhost response):
var %c = 1, %cc = $0
while (%c < %cc) {
inc %c
; REGEX: (nick)(*=+)(ident)@(host)
noop $regex($gettok($1-,%c,32),/(.+?)(\*?\=[+-])(.+?)@(.+)/)
echo -a .Nick: $regml(1)
echo -a .Mode: $regml(2)
if (* isin $regml(2)) echo -a Oper: Yes
else echo -a Oper: No
if (- isin $regml(2)) echo -a Away: Yes
elseif (+ isin $regml(2)) echo -a Away: No
echo -a Ident: $regml(3)
echo -a .Host: $regml(4)
}
The while loop is included because /userhost can support multiple nicks, so RAW 302 can return multiple sets of data.
Here is the equivalent of your code, except using USERHOST:
on *:JOIN:#support:{
if ($me isop $chan) {
set -u5 $+(%,UH.,$nick) 1
userhost $nick
}
}
RAW 302:*:{
var %c = 1, %cc = $0
while (%c < %cc) {
inc %c
; REGEX: (nick)(*=+)(ident)@(host)
noop $regex($gettok($1-,%c,32),/(.+?)(\*?\=[+-])(.+?)@(.+)/)
tokenize 32 $regml(1) $regml(2) $regml(3) $regml(4)
if ($($+(%,UH.,$1),2)) {
if ((* isin $2) && ($1 ison #support)) .mode #support +v $1
unset $+(%,UH.,$1)
haltdef
}
}
}
-genius_at_work