Who

From Scriptwiki
Revision as of 13:18, 8 April 2007 by Wiebe (talk | contribs)

Jump to: navigation, search

This command returns a single line of information for every user requested, and it is one of the most complex and powerful commands on ircu, no other command comes close to what it can do.

/WHO <mask> [[<match>][%<fields>[,<querytype>]] [:<mask>]]

Mask

Parameter <mask> can be:

A comma separated list of elements, then each element is treated as a flat nick or channel name and is not matched to other elements.

/WHO #chan1,#chan2
; show members on #chan1 and #chan2
/WHO nick1,nick2,nick3
; show info for nick1, nick2 and nick3
/WHO nick,#chan
; show members on #chan and info for nick

A single mask (no commas, only one element) and may contain wildcards, the mask is first checked to be a full channel or nickname, then it is matched against user, host, server, and real name.

/WHO a?cd*
; show users matching "a?cd*"


Match flags

Field matching flags in parameter <match>, when one of these is specified the field in question is matched against the mask, otherwise it is not matched. When not specified, the default of "nuhsr" is used.

n   Nick
u   Username
h   Hostname
i   Numeric IP (for IRC Operators only)
s   Servername (for IRC Operators only)
r   Realname
a   Account name (new in snircd)

When matching an IP, parameter <mask> may contain wildcards, and may be a CIDR mask (e.g. IP/24), or a netmask (e.g. IP/255.255.255.0).

The second <mask> parameter can be used, and may contain spaces for matching the realname field. The first <mask> parameter is ignored when the second is used.

/WHO *.org h
; show users with hostname matching *.org
/WHO *uk* nu
; show users with "uk" in their nick or username
/WHO 1.2.3.4 i
; show users with IP 1.2.3.4
/WHO 1.2.3.0/24 i
; show users from IP range 1.2.3.0 - 1.2.3.255
/WHO 0 r :*bot service*
; show users with "bot service" in their realname


Mode match flags

Mode matching flags:

d   Join-delayed channel members (new in snircd)
o   IRC Operator (specifying this one means only IRC Operators are matched)
/WHO #chan1,#chan2 d
; show join-delayed channel members
/WHO * o
; show IRC Operators
/WHO #chan1,#chan2 o
; show IRC Operators on #chan1 and #chan2


Special match flag

Special flag:

  x   Extended visibility of information for opers.

IRC Operators may use this flag to see in private (+p) or secret (+s) channels, and see invisible (+i) users. Only IRC Operators can use this flag, else it is ignored.

/WHO #chan x
; show all users on #chan
/WHO flood* nx
; show all users with nick matching "flood*"
/WHO 1.2.3.4 ix
; show all users connected from 1.2.3.4


Field flags

The parameter <fields> specifies which fields to include in the output as:

t   Include the querytype in the reply
c   Include (first) channel name (* when none can be shown)
u   Include userID with eventual ~
i   Include IP
h   Include hostname
s   Include server name
n   Include nick
f   Include flags
d   Include "distance" in hops
l   Include idle time (0 for remote users)
a   Include account name (0 when not authed)
o   Include oplevel (new in snircd)
r   Include real name
/WHO nick n%nuh
; show nick, user and hostname for nick
/WHO #chan %nuhf
; show nick, user, host and flags for users on #chan


Query type

The parameter <querytype> is to be used with the "t" field flag, and can be any number between 0-999 inclusive (default is 0). This number is returned in the output, useful to filter the output in scripts.

/WHO nick n%nuht,123
; show 123, nick, user and hostname for nick
/WHO #chan %nuhft,567
; show 567, nick, user, host and flags for users on #chan

The querytype number is not returned in the "end of /WHO list." reply, a trick can be used, but only for flat nicks and channels.

/WHO nick,123 n%nuht,123
; same as above, with 123 returned in the end of reply
/WHO #chan,567 %nuhft,567
; same as above, with 567 returned in the end of reply


Reply format

Only specified fields are returned in raw 354, but always in the same order:

[<querytype>] [<channel>] [<user>] [<ip>] [<host>] [<server>] [<nick>] [<flags>] [<distance>]
  [<idle time>] [<account>] [<oplevel>] [:<realname>]


Misc

A user is always returned only one time in the replies, even when matched by the input more than once.

/WHO #chan1,#chan2
; shows users on both channels only one time


The <flags> parameter in both type of replies is formated as <away>[<oper>][<chanstatus>][<usermodes>]. The user's away status is indicated with a "H" (here) or a "G" (gone). IRC Operator status is indicated with a "*". The user's status on the channel in the reply is indicated with a "@" when opped, a "+" when voiced, a "!" when zombie, and "<" when hidden. When using field flags to control the output, more than one of such channel status flag may be returned, while the normal replies show only one. The usermodes part shows usermode "d" and "x" to users, IRC Operators can see usermodes "i", "w" "g" and "h" as well.

The match and field flags are case insensitive, and the order in which they are specified does not matter. The maximum number of lines reported as reply for a query is "2048/(n+4)" where "n" is the number of field flags specified. This limit does not apply when the request is for a channel the client is on.

 1 field  returned = maximum 409 replies
 2 fields returned = maximum 341 replies
 3 fields returned = maximum 292 replies
 4 fields returned = maximum 256 replies
 5 fields returned = maximum 227 replies
 6 fields returned = maximum 204 replies
 7 fields returned = maximum 186 replies (default query)
 8 fields returned = maximum 170 replies
 9 fields returned = maximum 157 replies
10 fields returned = maximum 146 replies

The status of a channel private (+p) and secret (+s), and users being invisible (+i) may affect the result of /WHO.

For more info, visit https://svn.quakenet.org/svn/quakenet/snircd/trunk/doc/readme.who


internal notes (to be removed)

link to /KICK for zombie
link to /MODE or modes for +Ddps and +i
link to /AWAY
link to raw 315 352 354 in text
link to IAL etc, explains which kind updates the IAL and such
flags format in reply can be left out here, as it is explained in raw 352 and 354