mScriptBox Tutorial
Introduction to Addresses & Internal Address List (IAL)

Written by Hammer
Published with permission.

Table Of Contents

  1. Address Basics
  2. Internal Address List (IAL)
  3. Purpose of the IAL
  4. Accessing the IAL
  5. Displaying the IAL
  6. Adding addresses to the IAL
  7. Removing addresses from the IAL

1. Address Basics  Back to Top

Any address is composed of 3 or 4 parts:

This is known as the full address format ($fulladdress or $address($nick,5)). Let's define each of these parts separately.
This is the nickname by which that user is currently known on IRC.
Also known as userid or ident, it's a user-specified (normally) value.
This is the part of a named address that can change unless you have a static address (doesn't change from one IRC session to the next). If you are dialing in to your ISP, this will almost always change. It represents a computer name within your ISP's domain. Note: the $ial().host refers to the entire host.domain, a fact that is sometimes easy to forget.
Starting from the right, you might have a two-letter country code, such as .uk for addresses in the United Kingdom. If there is not country code, then the farthest right part is the top-level domain, such as .com, .net, .org, etc. The next field to the left indicates the organization (normally, your ISP). The next part to the left is the computer name. So, building that back into something we can read, we'll see:
mIRC considers everything from the organization onward to be the domain and everything to the left of the organization to be the host (in its host.domain format).
IP Address:
If your named address either took too long to resolve or was unable to be resolved by the server, you will come on IRC with the part after the @ sign being 4 numbers separated by periods. Normally, the periods in an IP address are called "dots" since it refers to what is known in TCP/IP as dotted decimal notation). It might look like or some other combination of numbers. Each of the four numbers must be in the range 0 to 255.

This means that valid addresses (the full address version) might look like

Hammer! or
depending on whether or not my named address resolved in time when I was logging on to IRC.

In both cases,

"Hammer" is the nick portion,
"mdr" is the user or ident portion. In the named address,
"td21p9" is the host portion and
"" is the domain portion. In the IP address,
"209.194.127" is the domain portion, while
"16" is the host (this is the only part we pay attention to normally).

2. Internal Address List (IAL)  Back to Top

Every nick that your computer "knows" about is contained in an internal data structure known as the Internal Address List. It contains the full address, including the nick, user and host.domain for every nick in every channel you are in, and it also includes your own address. These are stored in a sorted list (alphabetically by full address). This internal structure can be turned off (useful if it's slowing you down when you're in big channels).

3. Purpose of the IAL  Back to Top

The IAL is used in conjunction with user access levels for events. There are 2 ways to add people to your access list: /auser and /guser (which does a /userhost to look up their info for you and then adds them to the level you specified by address, rather than just by nick alone. However, you can /auser an address to a level. The way you remove a nick from an access level is by using the /ruser command which also uses the IAL. The mIRC commands /ban, /ignore, /finger, and /dns all use the IAL.

4. Accessing the IAL  Back to Top

There are 2 identifiers that deal specifically with the IAL: $ial(address,number) and $ialchan(address,channel,number).

$ial() deals with the entire IAL, whereas $ialchan() only deals with those addresses that are associated with the channel named in the second parameter. When you are checking for a clone, you only want to check in the channel that was joined. This means that $ial() isn't the identifier we want to use, $ialchan() is the correct identifier.

One common identifier that's used in many scripts is $address(). However, if the address isn't stored in the IAL (and the IAL is turned on), you cannot use that identifier because mIRC doesn't know about that nick's address. If you tried to use $address(somenick,3) prior to getting all the addresses into the IAL, it would evaluate (resolve) to $null.

5. Displaying the IAL  Back to Top

You can view your entire IAL by putting the following script into a remote file. Then from any edit box in any window, type: /list.ial

alias list.ial {
  window -k @Internal
  titlebar @Internal Address List
  SET -u %i 0
  INC -u %i
  IF ($ial(*,%i)) {
    IF (%i < 10) {
      aline -p @Internal $chr(160) $+ %i $+ . $ial(*,%i)
  ELSE { aline -p @Internal %i $+ . $ial(*,%i) }
  GOTO next.i

6. Adding addresses to the IAL  Back to Top

When you join a channel, the first thing mIRC does for you is open up a window for that channel's chat to go into; then it asks the server for a MODE of that channel in your behalf.
The first thing the server sends you is the channel topic, who set it and when. Then, the server tells you all the names that are in that channel - but it doesn't tell you anything else about those nicks.
This means that the addresses for those nicks are not yet in the IAL for those nicks unless they happen to be in your IAL from another channel with you.
Finally, you get the modes that are set for that channel (which mIRC kindly puts up in the topic bar of the channel right next to the channel name) and the channel creation time.

Remember, these nicks in that channel are not yet in your IAL. They will have to type something visible to you into the channel, or change channel modes in order for you to see their address on any messages. One way to get around this and to figure out who all is in the channel with their addresses is to /who #channelname. Here's a very simple way to accomplish this task for you automatically:

on ME:*:JOIN:#:who $chan

The server sends back one line of information about that nick that from which your IAL can pick up information it needs. This is an important point to remember, since you cannot look for clones (for example) in a channel when you first join a channel.

While this is normally done using the command /WHO #channel, a quicker way is to set up a raw event in your remotes to capture the initial /NAMES reply, remove the @ signs and + signs from the front of the nicks which have them, and send the result to a /USERHOST. This is quicker because /USERHOST gives you a reply on a single line of all the addresses you requested, rather than one line per user on that channel. However, it has 2 drawbacks: since there is a server imposed limit of less than 500 characters per line, the addresses of all the nicks on a /names reply in a large channel would be too long, so you have to shorten it by only asking for about 10 nicks per line; also, userhost doesn't have an End of /USERHOST reply. Obviously, in a 500 person channel, receiving back 50 lines is far more efficient than receiving back 500; it's easier on your mIRC and easier on your server, too. You can use this scriptlet in your remotes to use this method for you automatically:

RAW 353:*:{
  ; first, remove all the @'s and +'s from the front
  ; of the nicks that have them.
  SET -u %names.list $remove($remove($3-,+),@)
  ; now, loop through that list to send out a limit
  ; of 10 nicks per /userhost till the end of the
  ; list is reached.
  SET -u %i 0
  INC -u %i
  IF ($gettok(%names.list,%i,32)) {
    IF ($calc(%i % 10) == 0) {
      userhost %userhost.list
      UNSET %userhost.list
    SET %userhost.list %userhost.list $gettok(%names.list,%i,32)
    GOTO next

You can safely assume that your IAL is properly loaded. When someone joins the channel, their address information is provided with the JOIN message, so no special handling is needed there.

When a nick joins a channel that you are already in, the server will provide that nick's address on the join line mIRC receives. It is simply added to the IAL when you first see that nick. A nick will only ever have one entry in the IAL, no matter how many common channels they are in with you or if they are in private message with you.

7. Removing addresses from the IAL  Back to Top

When someone leaves the last common channel with they share with you, mIRC removes them from its IAL. It no longer needs to pay any attention to that nick. It's interesting to note that while you can help mIRC to add addresses to its IAL, you cannot help it remove any addresses. Also, if you are not in any channels, not even your own address is kept there, though mIRC does know what your address is.