IAL Clone Scanning

Contributed by ToPScriptz

IAL Clone Scanning

About

The scripting code examples shown have not been fully tested and are provided for information use relating to the $IALChan() identifier.

History

Back in the olden days of mirc an ial scan was not done using an internal adress list. It was done by doing a /who on the channel and saving the results to variables then comparing the variables once the /who was finished. Later the variables would be replaced by /write and $read. Nowadays mirc has a magnificent IAL which keeps itself updated automatically (to a certain extent).

Background Knowledge

If you are not familiar with the Internal Address List then read my tutorial The Complete Internal Address List at http://www.mircscripts.org. And ofcourse /help ial.

You should also be familiar with nickmasks, wildcards and Nick and Address Identifiers. Look for this information in your mirc help file.

Scanning the Channel IAL

The first thing our IAL scanner is going to do is check a channel(s) for a specific nickmask and return the nicknames of all the users matching it.

alias ialchanscan {
�� ;syntax: //echo ialscan: $ialchanscan(*!*@*.com,#channel).pnick
�� ;if $2 == $null then use $chan
�� var %chan = $iif(!$2,$chan,$2)
�� if ($1 = $null) || (!$isid) { echo Syntax: $ialchanscan(nickmask*!*@*,$iif(%chan,%chan,#channel)) | return Error }
�� if ($me !ison %chan) { echo -eat * You are not in %chan | return No matches found }
��
��
;Make sure the IAL is updated:
�� if (!$chan(%chan).ial) {
����
;Check if a /who is in progress before doing another:
���� if (!$chan(%chan).inwho) { /who %chan }
���� return Wait for the /who to finish. Then try again.
�� }
�� var %ial
��

�� ;Set the total number of matching users:
�� var %ial.total = $ialchan($1,%chan,0)
�� echo Total Matching Users: %ial.total out of $nick(%chan,0)
�� if (!%ial.total) { return No matches found }
�� var %nicks,%n,%i
��
�� :loop
�� inc %i
��
��
;Prefix the nickname with their channel mode (+/@/%):
�� if ($prop == pnick) { %n = $ialchan($1,%chan,%i).pnick }
�� else { %n = $gettok($ialchan($1,%chan,%i),1,33) }
��
��
;There are no more matches, so return the nicks found:
�� if (%n = $null) { return %nicks }
�� %nicks = %nicks %n
�� goto loop
}

With some quick modification the above alias can be used to scan clones using a /alias and having the results parsed, using $gettok($ialchanscan(),N,32), and displayed in an organized list however you want.

ON Join Clone Scan

Here is an example of a script which kicks clones as soon as they join.
on !@*:JOIN:#: {
��var %ial = $ialchan($address($nick,2),$chan,0)
��
;Set the nick to kick as the first IAL entry:
��var %nick.to.kick = $ialchan($address($nick,2),$chan,1)
��if (%ial > 1) {
����kick $chan %nick.to.kick You already have $calc(%ial - 1) clone in the channel.
����notice $nick Your clone %nick.to.kick was just kicked.
����
;You do not want to kick the active user clone and leave the "ghosted" nickname. So you kick the first IAL entry for that address.
����return
��}
}

To prevent excess kicking (flooding urself) set bans and/or channel modes accordingly.

End of Document

Author: ToPScriptz aka ToPDawG
Edited:
Contact: [email protected]
Date: Oct 15 2002

All content is copyright by mircscripts.org and cannot be used without permission. For more details, click here.