aIRC — File Browser
aIRCv0.8.69 / aIRCv0.8.69 / script / clones.mrc
clones.mrc — 8.86 KB — Download this file
;/**********************************************************************
; *
; * aIRC
; * Clones & Scanmask
; *
; **********************************************************************/
;;
;
; /clones <#channel>
;
alias clones {
if ($_disconnected) { return }
_clones $_parameter($iif(#$1- != $null,#$1-,#),1,Clone scanner [/clones],ismychan,#,Scan clones in channel:)
}
;;
;
; /_clones #channel [echo|scan]
;
alias _clones {
if ($_disconnected) { return }
var %chan = #$$1,%option = $2,%x,%y,%immunes
if ($istok(echo scan,%option,32) == $false) { %option = scan }
if ($chan(%chan).ial != $true) {
if ($me !ison %chan) { error.a You are not in %chan }
else { error.a IAL for %chan is not full yet... Please try again later. }
return
}
var %nopen = 0,%x,%y,%i = $ialchan(*,%chan,0),%m,%win = @__clones,%t = 0,%op = $iif($me isop %chan,1,0),%exemptops = $_prot.chansetting(exemptops,26,1,%chan),%exemptvoiced = $_prot.chansetting(exemptvoiced,27,1,$1),%protclones = $_prot.chansetting(cuclones,23,1,%chan),%maxclones = $_prot.chansetting(cuclones,23,2,%chan),%fm
if ($_not(%exemptops)) { %exemptops = 0 }
if ($_not(%exemptvoiced)) { %exemptvoiced = 0 }
_openwins %win
if (%option == scan) {
if ($window(@Clones) == $null) { window -hl -t2,32,52 @Clones $_window.conf(@Clones) }
else { %nopen = 1 }
clear @Clones
aline @Clones $chr(9)
aline @Clones $chr(9) $+ Nick $+ $chr(9) $+ Ident $+ $chr(9) $+ Host
aline @Clones $chr(9)
titlebar @Clones in %chan (scanning...)
sline -r %chan
}
elseif (%option == echo) {
}
%immunes = $_getclonimmunes(%chan)
while (%i) {
%fm = $ialchan(*,%chan,%i)
%m = $_mask(%fm,%_maskclon)
%x = $ialchan(%m,%chan,0)
if (%x > 1) && ($fline(%win,%m,0) == 0) && ($istok(%immunes,$gettok(%fm,2,64),32) == $false) {
%y = 1
inc %t %x
aline %win %m
if (%option == scan) {
while (%y <= %x) {
aline -a @Clones $chr(9) $+ $replace($ialchan(%m,%chan,%y),!,$chr(9),@,$chr(9))
sline -a %chan $ialchan(%m,%chan,%y).nick
inc %y
}
aline @Clones $chr(9)
}
elseif (%option == echo) { echo $colour(join) -t %chan $^clone(%chan,%m,$_ialnicks(%m,%chan,0,$null),%x,c) }
if (%protclones) && (%op) && (%x >= %maxclones) { _cclones %chan %m %exemptops %exemptvoiced }
}
dec %i
}
close -@ %win
if (%option == scan) {
if (%t) || (%nopen) {
titlebar @Clones in %chan ( $+ %t found $+ )
window -ak @Clones
_window.font.reset @Clones @Clones
dline @Clones $line(@Clones,0)
}
else {
close -@ @Clones
echo.w $colour(info) %chan $^*** No clones found in %chan
}
}
elseif (%option == echo) { echo $colour(info) -t %chan $^*** $iif(%t,%t,No) clones found in %chan }
}
alias _cclones {
var %chan = $1,%m = $2,%exemptops = $3,%exemptvoiced = $4,%i = $ialchan(%m,%chan,0),%nick,%fulladdress,%handle,%flags
while (%i) {
var %fulladdress = $ialchan(%m,%chan,%i),%nick = $gettok(%fulladdress,1,33)
if ($istok(0.0.0.0 x.x.x.x,$gettok(%fulladdress,2,64),32)) { return 0 }
if ($_iservice(%fulladdress)) { return 0 }
if (%nick == $me) { return 0 }
if (%exemptops) && (%nick isop %chan) { return 0 }
if (%exemptvoiced) && (%nick isvo %chan) { return 0 }
if ($_nick2hand(%nick) != $null) {
var %handle = $ifmatch,%flags = $_nickflags(%handle,%chan)
if (b isincs %flags) || (f isincs %flags) || (o isincs %flags) || (m isincs %flags) || (n isincs %flags) { return 0 }
}
dec %i
}
_dummy $_triggered(cuclones,%chan,$_nospaces(¶,cuclones,!,%m,%chan),%nick,$gettok(%fulladdress,2,64),$gettok(%fulladdress,2,33),%fulladdress,$ialchan(%m,%chan,0),$_prot.chansetting(cuclones,23,2,%chan),0,0,0)
return 1
}
; $_getclones(fulladdress,#channel|*,n,except).prop
; Prop can be number or nicks
alias _getclones {
var %fulladdress = $1,%mask = $_mask(%fulladdress,%_maskclon),%chan = $2,%max = $3,%except = $4,%total
if ($_not($_ischan(%chan))) { %chan = * }
if ($_not($_isint(%max))) { %max = 0 }
%total = $ialchan(%mask,%chan,0)
if ($istok(0.0.0.0 x.x.x.x,$gettok(%fulladdress,2,64),32)) { %total = 0 }
if (%total == 1) { %total = 0 }
if ($prop == number) { return %total }
if (%total) { return $_ialnicks(%mask,%chan,%max,%except) }
}
alias `clonesp.pre {
var %win = $active,%chan = $gettok($window(%win).title,2,32)
unset %`clones.*
if ($sline(%win,1).ln > 3) && ($count($sline(%win,1),$chr(9)) > 1) {
set -u %`clones.nick $gettok($sline(%win,1),1,9)
set -u %`clones.ident $gettok($sline(%win,1),2,9)
set -u %`clones.host $gettok($sline(%win,1),3,9)
if ($_connected) { set -u %`clones.snick $gettok($sline(%win,1),1,9) }
}
if ($_connected) {
if ($me ison %chan) { set -u %`clones.ison 1 }
if ($me isop %chan) { set -u %`clones.op 1 }
}
}
alias 'clonesp.nick { return $gettok($sline($active,1),1,9) }
alias 'clonesp.nicks {
var %win = $active,%i = $sline(%win,0),%r
while (%i) {
if ($count($sline($active,%i),$chr(9)) > 1) { %r = $addtok(%r,$gettok($sline($active,%i),1,9),44) }
dec %i
}
return %r
}
alias 'clonesp.host { return $gettok($sline($active,1),3,9) }
menu @Clones {
dclick:{
if ($_connected) && ($sline($active,1).ln > 3) && ($count($sline($active,1),$chr(9)) > 1) { whois $'clonesp.nick }
}
$`clonesp.pre:{ }
$iif(%`clones.snick,&whois):{ .quote whois $'clonesp.nicks }
$iif(%`clones.snick,&ping):{ ctcp $'clonesp.nicks ping }
$iif(%`clones.op && %`clones.snick,&kick/ban)
.&kick
..&quick:{ kick $gettok($window($active).title,2,32) $'clonesp.nicks }
..&reason...:{ kick $gettok($window($active).title,2,32) $'clonesp.nicks $_rparam(normal,$null,kickreason,$gettok($window($active).title,2,32),Kick reason:) }
.-
.&ban:{ ban $gettok($window($active).title,2,32) $'clonesp.nicks }
.ban t&ypes
..$mask(nick!ident@blah.host.com,0):{ ban $gettok($window($active).title,2,32) $'clonesp.nicks 0 }
..$mask(nick!ident@blah.host.com,1):{ ban $gettok($window($active).title,2,32) $'clonesp.nicks 1 }
..$mask(nick!ident@blah.host.com,2):{ ban $gettok($window($active).title,2,32) $'clonesp.nicks 2 }
..$mask(nick!ident@blah.host.com,3):{ ban $gettok($window($active).title,2,32) $'clonesp.nicks 3 }
..$mask(nick!ident@blah.host.com,4):{ ban $gettok($window($active).title,2,32) $'clonesp.nicks 4 }
..$mask(nick!ident@blah.host.com,5):{ ban $gettok($window($active).title,2,32) $'clonesp.nicks 5 }
..$mask(nick!ident@blah.host.com,6):{ ban $gettok($window($active).title,2,32) $'clonesp.nicks 6 }
..$mask(nick!ident@blah.host.com,7):{ ban $gettok($window($active).title,2,32) $'clonesp.nicks 7 }
..$mask(nick!ident@blah.host.com,8):{ ban $gettok($window($active).title,2,32) $'clonesp.nicks 8 }
..$mask(nick!ident@blah.host.com,9):{ ban $gettok($window($active).title,2,32) $'clonesp.nicks 9 }
.&temp ban...:{ ban -u $+ $_param(isint,$null,Enter number of seconds to ban:) $gettok($window($active).title,2,32) $'clonesp.nicks }
.-
.kick/ban
..&quick:{ kb $gettok($window($active).title,2,32) $'clonesp.nicks }
..&reason...:{ kb $gettok($window($active).title,2,32) $'clonesp.nicks $_rparam(normal,$null,kickreason,$gettok($window($active).title,2,32),Kick/Ban reason:) }
..&temp...:{ kb -u $+ $_param(isint,$null,Enter number of seconds to kick/ban:) $gettok($window($active).title,2,32) $'clonesp.nicks }
.ban/kick
..&quick:{ bk $gettok($window($active).title,2,32) $'clonesp.nicks }
..&reason...:{ bk $gettok($window($active).title,2,32) $'clonesp.nicks $_rparam(normal,$null,kickreason,$gettok($window($active).title,2,32),Ban/Kick reason:) }
..&temp...:{ bk -u $+ $_param(isint,$null,Enter number of seconds to ban/kick:) $gettok($window($active).title,2,32) $'clonesp.nicks }
$iif(%`clones.op && %`clones.snick,&kick)
.&quick:{ kick $gettok($window($active).title,2,32) $'clonesp.nicks }
.&reason:{ kick $gettok($window($active).title,2,32) $'clonesp.nicks $_rparameter($null,1,Clones [/clones],normal,clones!,kickreason,$gettok($window($active).title,2,32),Reason to kick:) }
-
$iif(%`clones.snick,&ucentral):{ uwho $'clonesp.nick }
$iif(%`clones.snick,&abook):{ abook $'clonesp.nick }
$iif(%`clones.host,&finger):{ finger $'clonesp.host }
-
$iif(%`clones.host && $_portscan.addonver,port&scan):{ portscan $'clonesp.host }
$iif(%`clones.host && $_portscan.addonver,&ports?...):{ portscan $'clonesp.host ? }
-
$iif(%`clones.op,&refresh):{ clones $gettok($window($active).title,2,32) }
$iif($_connected && $comchan($me,0),&scan...):{ clones $_selectedit($null,1,Clones [/clones],ismychan,$iif($me ison $gettok($window($active).title,2,32),$gettok($window($active).title,2,32),$gettok($_mychans,1,32)),32,$_mychans,Channel:) }
}
alias _windowsize.Clones { return C C 550 241 }
alias _windowopts.Clones { return 0 1 1 }