All pastes #266523 Raw Edit

Untitled

public text v1 · immutable
·published 2006-12-04 05:40 UTC
rendered paste body
on $*:TEXT:/^[!.]hostcheck */Si:#:{
  if (*!*@* !iswm $2) {
    .notice $nick Invalid hostmask format.
    halt
  }
  set %hostcheck.mask $2
  set %hostcheck.target msg $chan
  .enable #hostcheck
  who $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 $+(,$6,,$chr(44))
  }
  elseif ($numeric == 315) {
    set %hostcheck.line $left(%hostcheck.line,-1)
    %hostcheck.target Search finished: $+($chr(40),$iif(%hostcheck.line,$numtok($ifmatch,44),No) matches found,$chr(41))
    $iif(%hostcheck.line,%hostcheck.target $ifmatch)
    .disable #hostcheck
    cleanup
  }
}
#hostcheck end
alias -l cleanup { unset %hostcheck.* }