Clone Detection
Platform: mIRC
Published Feb 19, 2011
Updated Feb 20, 2011
Yes, I realize it's a common snippet but I decided to do some brushing up on mIRC today and it's what came to mind, so enjoy. :D
I had originally coded it to work in conjunction with the "Join" event, but I decided to add Text event support providing some conformity for the various needs.
-Functions-
- $clone(#Channel,Host/Wildcard).join -- Scans the channel specified for any matching hosts and lists the nicks with the matching hosts.
- $clone(#channel).text -- Scans the entire channel for any duplicate hosts and lists them according to Address and nicks that address is associated with.
Obviously I named the alias properties after the event it works best with but feel free to alter it how you will to fit your needs. PLEASE NOTE: It will not work without an attached property. (EX. $clone(#) will render no response.)
on !*:JOIN:#:{ /noop $clone(#,$address($nick,2)).join } }
alias clone {
goto $iif($istok(join text,$prop,32),$prop)
:join
if ($ialchan($2,$1,0) > 1) {
var %a = 1,%c = $v1
while (%a <= %c) {
var %b %b $gettok($ialchan($2,$1,%a),1,33)
inc %a
}
.timer 1 0 echo -t $1 06[Clone] Address:( $+ $2 $+ ) Nicks:( $+ $replace(%b,$chr(32),$+($chr(44),$chr(32))) $+ )
halt
}
:text
var %a = 1,%b = 1,%d = 0
while (%a <= $nick($1,0) && !$findtok(%c,$nick($1,%a),1,32)) {
inc %d
if ($ialchan($address($nick($1,%a),2),$1,0) > 1) {
while (%b <= $ialchan($address($nick($1,%a),2),$1,0)) {
hadd -m Clone %d $hget(Clone,%d) $gettok($ialchan($address($nick($1,%a),2),$1,%b),1,33)
inc %b
}
}
if ($hget(Clone,%d)) { msg $chan 06[Clone] Address:( $+ $address($gettok($hget(Clone,%d),1,32),2) $+ ) Nicks:( $+ $replace($hget(Clone,%d),$chr(32),$+($chr(44),$chr(32))) $+ ) | hfree Clone }
inc %a
}
}