Who

From Scriptwiki
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. Normally the information includes (first) channel name, user, host, server, nick, flags, distance, and realname, and more is possible, the results can be customized and easily filtered with a script.

/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*"


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 once
/WHO a?cd*
; shows a user with matching nick and realname once


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
s   Servername
r   Realname
a   Account name (new in snircd)

These flags are case insensitive (e.g. N is the same as n), and the order in which they are specified does not matter.

/WHO *.org h
; show users with hostname matching *.org
/WHO *uk* nu
; show users with "uk" in their nick or username


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).

/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


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 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 flags given in parameter <fields> specify which fields to include in the output.

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

These flags are case insensitive (e.g. N is the same as n), and the order in which they are specified does not matter.

/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 raw numeric 315 RPL_ENDOFWHO, which marks the end of the reply. However, 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


Separate reply format

A separate raw numeric, 354 RPL_WHOSPCRPL, is used, to avoid confusing clients with different replies, and only the specified fields are returned, but always in the same order:

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


Replies

IAL

The IAL can only be updated with the normal replies, and not with field flags since that is using a different numeric.


Flags

The <flags> parameter in both type of replies is formated as <away>[<oper>][<chan>][<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, in addition, IRC Operators can see usermodes "i", "w" "g" and "h".


Modes & HIS

The status of a channel private (+p) or secret (+s), and users being invisible (+i) may affect the result of /WHO. Also Head In Sand (HIS) settings may limit certain features for users (e.g. match flag "s" for server, "i" for IP), and obscure information in the replies for users (e.g. server name, idle time, hopcount, IP).


Limit

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
11 fields returned = maximum 136 replies
12 fields returned = maximum 128 replies
13 fields returned = maximum 120 replies


See also