Note: The mainteinance of the scripting examples is discontinued since I no longer have an interest to continue doing so. The pages will remain here, for now, but that might not be the case in the future. You are free to download all the material on these pages and set a up mirror, or even continue the maintenance of the material by enhancing the examples yourself.

All the material in these examples are for the mIRC version 6.03. It is very likely that some or most of these examples won't work in future versions.

How to make my own outlook for /whois replies?

Making your own outlook for whois replies uses lots of same elements already discussed on making your own who replies so please see it first. RFC1459 specifies that a succesful whois query is replied with:

Numeric 311: <nick> <user> <host> * :<real name>
Numeric 319: <nick> :{[@|+]<channel><space>}
Numeric 312: <nick> <server> :<server info>
Numeric 301: <nick> :<away message>
Numeric 313: <nick> :is an IRC operator
Numeric 317: <nick> <integer> :seconds idle
Numeric 318: <nick> :End of /WHOIS list

Note that 301 is not a whois specific reply. It is also sent when you send a private message to the user. 312 is used in whowas replies. If you do a whois query to multiple nicks, like /whois Jack,Fred, the server will send out all replies for Jack except the 318 which is sent only after Fred's replies have arrived.

Actually reformatting output of raw events is very easy. All you need to know is what format the replies come in. RFC1459 and Jeepster's numeric list are helpful in this matter. Also mIRC strips all strings beginning with : to their original state so you don't have to worry about that either. The script needs to have echo and halt, nothing else is required.

If you are planning to use only one color, it's best to use the whois text color from Tools/Colors. The example script outputs to status window but you can of course output to any window you like.

Example script

; Full address, real name
raw 311:*: {
  echo $color(whois text) -s Full address: $2 $+ ! $+ $3 $+ @ $+ $4
  echo $color(whois text) -s Real name: $6-

; Channels, sort the channels to order: @#channel, +#channel, #channel
raw 319:*: { echo $color(whois text) -s Channels: $sorttok($3-,32,c) | halt }

; Server and server description
raw 312:*: { echo $color(whois text) -s Server: $3 ( $+ $4- $+ ) | halt }

; DALnet nick registration information (maybe other networks too?)
raw 307:*: { echo $color(whois text) -s $2 $3- | halt }

; Away message, sent only when user is away
raw 301:*: { echo $color(whois text) -s $2 is away: $3- | halt }

; IRC operator status, the script is using $5- because some networks have different
; messages to indicate operator status. The string always begins like "is a/an", so
; cut out the first two words ($3-4)
raw 313:*: { echo $color(whois text) -s Status: $5- | halt }

; DALnet help operator reply
raw 310:*: { echo $color(whois text) -s $2 $3- | halt }

; Idle time, some servers also give signon time (login time) which has to be converted with $asctime
raw 317:*: {
  echo $color(whois text) -s Idle time: $duration($3)
  if ( $4 isnum ) echo $color(whois text) -s Signon time: $asctime($4)

; End of whois
raw 318:*: { echo $color(whois text) -s End of Whois reply | linesep -s | halt }

Sample output

Full address: Fred!
Real name: Fred Smith
Channels: @#chat +#stars #fun
Server: (The Big Apple)
Fred is away: Gone
Idle time: 1hr 45mins 23secs
End of Whois reply

Note that many networks have made their own modifications to whois replies. They might tell about nick registration, host cloaking, and different kind of IRC operator duties. Unfortunately complying with these multiple and overlapping standards is very hard. You can probably make a script that understands the whois replies of your home network but at present it's impossible to do universal whois theme unless you simply ignore all unknown numerics.

Last updated 2003-04-05, Janne 'Geetee' Nikula,