/*
I need help from an mirc scripter, who can also design a database structure and describe what the files will look like because I am having the hardest time making an entire ial compressed in 1 or 2 files for 1 network.
A database must be created and written to/deleted from as the normal
ial would be updated. the database also needs to be able to be refreshed using the alias I have below.

I want to provide input to an html file showing
ial'd users on 1 network which are also on another network under a different nickname.

While its at it also the clones on each network's ial'd channels.

Also show two clones (different nicks) where they are not
in the same channel but are on 2+ different channels on same network.

*/
on *:exit:.remove clones.txt
alias ialf {
write -c clones.txt
var %ialfinder = ialfinder
/scon -s 1
ialfinder 1
}
alias -l ialfinder {
/*
this number is the scon to start; being increased until null. /scon makes all $ial etc. vars become relative the next connections network.
*/
if ($1 isnum) {
if (!$var($1).local) { var %scon.i = 1 }
else { var %scon.i = $1 }
}
else { var %scon.i = 1 }

; the same $network SHOULD not be written twice:
if (!$network) { goto s }
var %totalial = $calc(%totalial + $ial(*,0))
var %ial.i = 0
:ial
inc %ial.i
/*
All IAL address's are being written because we want to show
hostnames that appear once on two different networks. or multiple
hostnames 1 person can be identified as.
note: otherwise $ial(*!*@addr,0) > 1 easily identifies a clone on 1 network!
*/
var %ial = $ial(*,%ial.i)
var %nick = $ial(*,%ial.i).nick
if (!%ial) { goto end }
var %writes = $calc(%writes + 1)
var %chan = $comchan(%nick,1)
var %clone = $network %chan $mask(%ial,2)
;no -s switch is present. there is a critical $network conflict.
write clones.txt %clone $nick
goto ial

:end
inc %ci
%chan = $chan(%ci)

:s
inc %scon.i
if (%scon.i > $scon(0)) {
/scon -r
return
}
//scon -s %scon.i /ialfinder %scon.i
}