Using the IAL and Addresses

Contributed by anthr4x
mIRC contains an internal list all of all users who join and part the same channels as you. This address list is used by the /guser, /ruser, /ban, /ignore, /finger, /dns and other commands to find a user's address and other info without resorting to a /userhost server lookup and in the end, much faster. A user's info is added to the list either when you perform a /whois [nick], /who [#channel], they join the channel, send a message to a channel, or make a mode change. A user's info is removed from the list when they arent on any of the channels which you are on.
The Address
An address ususally has 4 parts: nick, userid, host, domain, in this format: [email protected]. If the server took to long to find the address, you will have an ip address as a host after the nick!user@. Its made of 4 numbers ranging from 0 to 255 separated by dots. These addresses are the Identification for the user.

normal address: [email protected]
ip address: [email protected]

nick: anthr4x
userid: ramdac
mainhost: cable77-91.sudbury.cyberbeach
domain: .net
Wildcards (Using the * Character)
Wildcards are used to show "anything", therefore they are "wild". Sections in blue represent the matching parts.

ex: *!*@* is equal to [email protected]
ex: *thr4*!*am@*ber*.ne* is equal to anthr4x!ram[email protected]berbeach.net
ex: *!*@*9* is equal to anthr4x!ramdac@cable77-91.sudbury.cyberbeach.net
IAL Commands
/clearial Removes all information currently being stored in the ial.
/ial on Turns the IAL on.
/ial off Turns the IAL off.

To fill the ial, you may consider something like this:
on *:join:#: {
  if ($nick == $me) who $chan
}
IAL Identifiers
Global identifier: $ial()

All addreses found in the IAL list can be shown with $ial. This is the gobal identifier for the IAL (Meaning all information in the IAL). It contains 3 elements for every user: Nickname, Userid, and Host.

Format: $ial(mask,N)

Property formats:

$ial(mask,N).user Returns the userid of the Nth specified mask in the IAL.
$ial(mask,N).host Returns the host of the Nth specified mask in the IAL.
$ial(mask,N).nick Returns the nick of the Nth specified mask in the IAL.
$ial(mask,N).addr Returns the address (U@H) of the Nth specified mask in the IAL.

Property examples:
$ial(*!*@*,0)              Returns the total number of addresses in the IAL.
$ial(*!*@*,20).host        Returns the host is of the 20th specified mask in the IAL.
$ial(*nthr*!*@*,1).nick    Returns the 1st nick of any addresses matching *nthr*!*@* in the IAL.
$ial(*!*x*@*,3).addr       Returns the 3rd address (U@H) that matches *!*x*@* in the IAL.
$ial(*!*@*net*,2)          Returns the 2nd address that matches *!*@*net* from the IAL.
Local identifier: $ialchan()

All addreses found in the specified channel IAL list can be shown with $ialchan. This is the local identifier for the IAL (Meaning all information in the specified channel IAL). It contains the same information as $ial does, but is a lot faster by keeping the search local, confined to the specified channel.

Format: $ialchan(mask,#channel,N)

Property formats:

$ialchan(mask,#channel,N).user Returns the userid of the Nth specified mask in the IAL.
$ialchan(mask,#channel,N).host Returns the host of the Nth specified mask in the IAL.
$ialchan(mask,#channel,N).nick Returns the nick of the Nth specified mask in the IAL.
$ialchan(mask,#channel,N).addr Returns the address (U@H) of the Nth specified mask in the IAL.

Property examples:
$ialchan(*!*@*,#Test,0).user         Returns the total number of addresses in the IAL of #Test.
$ialchan(*!*@*,#Test,11).host        Returns the host of the 11th address in the IAL of #Test.
$ialchan(*thrax*!*@*,#Test,1).nick   Returns the 1st nick matching *thrax*!*@* in the IAL of #Test.
$ialchan(*!*@*y*,#Test,12).addr      Returns the 12th matching address of *!*y*@* of the IAL of #Test.
$ialchan(*!*@*com*,#Test,2)          Returns 2nd address (U@H) of the IAL of #Test, matching *!*@*com*.
Other identifiers from the same branch as $ial() and $ialchan()

$ibl()
$level()
$mask()
$nick()
$address()
Using the IAL
To list all info in the global IAL, $ial, You must first learn while loops. If you already understand wile loops, you should have no problem understanding this:

Syntax: /ial.list
alias ial.list {
  var %ial.c = 0, %ial.t = $ial(*,0)
  ; set 2 local variables: one for the loop (%ial.c) and
  ; one for the total number of addresses in the ial (%ial.t)
  while (%ial.c < %ial.t) {
    if ($window(@ial) == $null) { window -k -t20,25,80 @ial } 
    ; if the window, @ial, isint up, open a list window (-k) with tabs with the -t switch
    ; (20,25,80)
    else { 
      inc %ial.c 1 
      ; increse %ial.c so it doesnt use the same N.
      aline @ial $ial(*!*@*,%ial.c).nick $chr(9) $ial(*!*@*,%ial.c).addr $chr(9) %ial.c
      ; add a line (aline) to @ial in this format: Nick Address Number
    }
  }
}
To find a specific string from the ial, use this. Again, you must know while loops. However, for a long-looking command, it works pretty simple.

Syntax: /fa [#channel] [String (*!*@*)]
alias fa { 
  if ($1 == $null) || ($2 == $null) || ($1 !ischan) { 
    echo -a syntax: /fa [#channel] [String (*!*@*)] | goto end
    ; Makes sure you gave all the necessary parameters, if not, it goes to :end.
  }
  else {
    ; If all is ok, it begins searching
    var %i = 0
    ; sets a local variable, %i, to act as the number
    while ($ialchan($2,$1,0) > %i) {
    ; the statement above indicates that while the total number of users that match that address is greater than %i
      inc %i  
      ; increases %i, to not show the same address over and over.
      echo -a $2 $chr(9) $ialchan($2,$1,%i).nick $chr(9) $ialchan($2,$1,%i).addr 
      ; if an address was found ($ialchan($2,$1,0) was greater than %i) it echo's it. 
    }
    if ($ialchan($2,$1,0) == 0) { 
      ; if it didnt, ($ialchan($2,$1,0) was equal to 0) it lets you know.
      echo -a No Matches for $2 were found on $1 $+ .
    }  
    :end
    ; end
  }
}
More Information on the IAL and Address-Related Functions
/auser = Adds the specified nick or address exactly as it is given to the user list with the specified levels.
syntax: /auser [-a] [levels] [nick/address] [infoline]

/guser = Looks the up address of the specified nick and adds it to the user list.
syntax: /guser [-a] [levels] [nick/address] [infoline]

/ruser = Removes the specified user from the user list.
syntax: /ruser [levels] [nick|address] [type]

/help Remote Commands (For more info on user lists)

/dns = Resolves addresses.
syntax: /dns [-ch] [nick|address]
-c Clears all queued dns's
-h Forces it to treat it as a hostname

/ban = Sets a ban on a specified address. (Usually performed in a combination with a kick)
syntax: /ban [-ruN] [#channel] [nickname|address] [type]
-uN For a timed ban. (after N seconed, mIRC unbans)
-r Removes a ban

/Finger = Finger a persons address to find out more information about them. (Realname, E-mail, Idle time, Connection time, more...)
syntax: /finger [nick/address]

/Who = Gathers information for the IAL. Should be performed whenever you join a channel.
syntax: /who [#channel]
Use (in remotes):
on *:join:#: {
  if ($nick == $me) who $chan
}
raw 352:*: {
  echo -s $2-
  halt 
}
/who returns info in this format: Channel Username Address Server Nick Flags Server-hops Name
All content is copyright by mircscripts.org and cannot be used without permission. For more details, click here.