New /WHO command which allows to specify a format.


m_who() has been rewritten, now the /who command is much more flexible and provides new options that (I hope) scripters and client coders will love. Many CPU suckers in there have been shot in the meanwhile.

TOTAL compatibility has been kept with the existing command, except for the query size limit you can live without reading this, but if you are a client/script coder you'll miss something interesting :).

Format of the new /who query:

:source WHO "masklist" ["flaglist"[,"quertype"]] ["masklist"]

"masklist"   ::=   "nowildlist" | "wildmask"
"wildmask"   ::= "mask" (matched against all the fields)
"nowildlist" ::= ( channel | nick ) [ , ( channel | nick ) ]...
"flaglist"   ::= [(filterflag)]... ['%' (formatflag)... ]
"filterflag" ::= o
"formatflag" ::= c | u | i | h | s | n | f | d | r | t
"querytype"  ::= Any number in the range 0-999 (defaults to 0)
Where the 'o' in filterflag has the known "/who 0 o" usage and what comes after the '%' specifies the fields to be included (order and case is not significant)
c : Include (first) channel name
d : Include "distance" in hops (hopcount)
f : Include flags (all of them)
h : Include hostname
i : Include IP
n : Include nick
r : Include real name
s : Include server name
t : Include the querytype in the reply
u : Include userID with eventual ~
The default is a %cuisnfr that reports all the standard fields (it does NOT report the hopcount since it is no more included into the real name)

The reply can be in two forms:

If now %flags are specified the reply is exactly the same as has always been, numeric 352, same fields, same order.

If one or more %flags are specified the reply uses a new numeric, since an out-of-standard 352 crashes EPIC and confuses several other clients. I used 354.

:"source" 354 "target" ["querytype"] ["channel"] ["user"] 
                       ["IP"] ["host"] ["server"] ["nick"] 
                       ["flags"] ["hops"] [:"realname"]
Where only the fields specified in the %flags are present.

"querytype" is the same value passed in the /who command, it is provided to simplify scripting, in example one could pass a certain value in the query and have that value "signal" back what is to be done with those replies.

Note that:

The actual query to match can have one of the two following forms: Miscellaneous bug fixes / "undocumented feature" changes: Regards, Andrea aka Nemesi 
Questions and comments about this page should go to the maintainer: Carlo Wood (Run @ IRC).