on $10:TEXT:/^[!@.]hostcheck */Si:#:{
if ($2 == -j) {
if ($left($3,1) != $chr(35)) {
.notice $nick $c1(Please specify a valid channel name.)
halt
}
elseif (*!*@* !iswm $4) {
.notice $nick $c1(Invalid hostmask format $chr(40) $+ Must be in the format) $c2(nick!ident@host) $+ $c1($chr(41) $+ .)
halt
}
elseif ($me ison $3) {
set %hostcheck.chan $3
set %hostcheck.mask $4
}
else {
join $3
set %hostcheck.join on
set %hostcheck.chan $3
set %hostcheck.mask $4
}
}
elseif ($left($2,1) == $chr(35)) {
if ($me !ison $2) {
.notice $nick $c1(I'm not currently in) $+($c2($2),$c1(.))
halt
}
elseif (*!*@* !iswm $3) {
.notice $nick Invalid hostmask format.
halt
}
else {
set %hostcheck.chan $2
set %hostcheck.mask $3
}
}
else {
if (*!*@* !iswm $2) {
.notice $nick $c1(Invalid hostmask format $chr(40) $+ Must be in the format) $c2(nick!ident@host) $+ $c1($chr(41) $+ .)
halt
}
else {
set %hostcheck.mask $2
set %hostcheck.chan $chan
}
}
set %hostcheck.target $iif(@* iswm $1,msg $chan,.notice $nick)
.enable #hostcheck
who %hostcheck.chan
}
#hostcheck off
raw *:*:{
if ($istok(352 315,$numeric,32)) haltdef
if ($numeric == 352) {
var %mask = $+($6,!,$3,@,$4)
if (%hostcheck.mask iswm %mask) set %hostcheck.line %hostcheck.line $+($c2($6),$c1($chr(44)))
}
elseif ($numeric == 315) {
set %hostcheck.line $left(%hostcheck.line,-4)
%hostcheck.target $c1(Search finished) $+($c1($chr(40)),$iif(%hostcheck.line,$c2($numtok($ifmatch,44)),$c1(No)) $c1($iif($numtok(%hostcheck.line,44) == 1,match,matches) found $+ $chr(41)))
$iif(%hostcheck.line,%hostcheck.target $ifmatch)
$iif(%hostcheck.join,part %hostcheck.chan)
.disable #hostcheck
cleanup
}
}
#hostcheck end
alias -l cleanup { unset %hostcheck.* }
alias -l c1 { return $+(14,$1-,) }
alias -l c2 { return $+(07,$1-,) }