Difference between revisions of "Who"

From Scriptwiki
Jump to: navigation, search
 
m (See also: fixed url)
 
(28 intermediate revisions by 2 users not shown)
Line 1: Line 1:
WHO
+
{{Stub}}
 +
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.
  
syntax: /WHO <mask> [[<flags>][%<fields>[,<querytype>]] [:<mask>]]
+
/WHO <mask> [[<match>][%<fields>[,<querytype>]] [:<mask>]]
  
 +
== Mask ==
 
Parameter <mask> can be:
 
Parameter <mask> can be:
A comma separated list of elements, then each element is treated as a flat channel or nick name and is not matched to other elements.
 
  
/WHO #chan1,#chan2        show members on #chan1 and #chan2
+
* 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 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 containt wildcards, the mask is first checked to be a full channel or nickname, then it is matched against the given flags (default nuhsr).
+
/WHO #chan1,#chan2
 +
; show members on #chan1 and #chan2
  
  /WHO a?cd*                show users matching "a?cd*"
+
  /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
  
Field matching flags, when one of these is specified the field in question is matched against the mask, otherwise it is not matched.
 
  n  Nick
 
  u  Username
 
  h  Hostname
 
  i  Numeric IP (disabled on QuakeNet)
 
  s  Servername
 
  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).
 
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.
 
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 0 r :*bot service*
/WHO *uk* nu              show users with "uk" in their nick or username
+
; show users with "bot service" in their realname
/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)
  
User mode matching flags:
+
/WHO #chan1,#chan2 d
  d  Join-delayed channel members (new in snircd)
+
; show join-delayed channel members
  o  IRC Operator (specifying this one means only IRC Operators are matched)
 
  
/WHO #chan1,#chan2 d      show join-delayed channel members
+
  /WHO * o
  /WHO * o                   show IRC Operators
+
  ; show IRC Operators
  /WHO #chan1,#chan2 o      show IRC Operators on #chan1 and #chan2
 
  
 +
/WHO #chan1,#chan2 o
 +
; show IRC Operators on #chan1 and #chan2
  
  
Special purpose flags:
+
=== Special match flag ===
 +
Special flag:
  
  x  Extended visibility of information for opers.
+
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.
 
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 #chan x
  /WHO flood* nx             show all users with nick matching "flood*"
+
; show all users on #chan
  /WHO 1.2.3.4 ix           show all users connected from 1.2.3.4
+
 
 +
  /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.
  
The parameter <fields> specifies which fields to include in the output as:
+
/WHO nick n%nuh
  t  Include the querytype in the reply
+
; show nick, user and hostname for nick
  c  Include (first) channel name
 
  u  Include userID with eventual ~
 
  i  Include IP (always show your own real IP, always 127.0.0.1 for others)
 
  h  Include hostname
 
  s  Include server name
 
  n  Include nick
 
  f  Include flags
 
  d  Include "distance" in hops (always 3 for others, 0 for yourself)
 
  l  Include idle time (only works for yourself)
 
  a  Include account name
 
  o  Include oplevel (shows 999 to users without ops in the channel) (new in snircd, ignore for now)
 
  r  Include real name
 
  
/WHO nick n%nuh            show nick, user and hostname for nick
+
  /WHO #chan %nuhf
  /WHO #chan %nuhf           show nick, user, host and flags for users on #chan
+
; 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.
 
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 nick, user and hostname for nick
+
  /WHO nick n%nuht,123
/WHO #chan %nuhft,567      show nick, user, host and flags for users on #chan
+
; show 123, nick, user and hostname for nick
  
Unfortunately, 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 #chan %nuhft,567
 +
; show 567, nick, user, host and flags for users on #chan
 +
 
 +
The querytype number is not returned raw numeric [[Raw_315|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
 
  /WHO nick,123 n%nuht,123
 +
; same as above, with 123 returned in the end of reply
 +
 
  /WHO #chan,567 %nuhft,567
 
  /WHO #chan,567 %nuhft,567
 +
; same as above, with 567 returned in the end of reply
 +
 +
 +
=== Separate reply format ===
 +
A separate raw numeric, [[raw_354|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 [[:Category:IAL|IAL]] can only be updated with the normal replies, and not with field flags since that is using a different numeric.
  
Only specified fields are returned, but always in the same order:
 
[<querytype>] [<channel>] [<user>] [<ip>] [<host>] [<server>] [<nick>] [<flags>] [<distance>] [<idle time>] [<account>] [<oplevel>] [:<realname>]
 
  
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.
+
=== 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 [[kick|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".
  
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.
+
 
 +
=== 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
 
   1 field  returned = maximum 409 replies
Line 103: Line 178:
 
   9 fields returned = maximum 157 replies
 
   9 fields returned = maximum 157 replies
 
  10 fields returned = maximum 146 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
  
The status of a channel private (+p) and secret (+s), as well as 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
 
 
 
[[Category:Raw_who]][[Category:Basic IRC commands]]
 
 
 
internal note
 
  
link to /KICK for zombie
+
== See also ==
 +
* [http://hg.quakenet.org/snircd/file/bd1b1df869d1/doc/readme.who readme.who]
 +
* [[away|AWAY]] [[kick|KICK]] [[mode|MODE]] [[whois|WHOIS]]
 +
* [[:Category:Raw_who|raw numerics]]
  
link to /MODE or modes for +ps and +i
+
[[Category:Basic IRC commands]][[Category:Raw_who]][[Category:IAL]]

Latest revision as of 17:29, 4 June 2007

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