All pastes #494332 Raw Edit

Untitled

public text v1 · immutable
·published 2007-05-18 05:33 UTC
rendered paste body
on $10:TEXT:/^[`~.]w(ho)?m(ask)?( .+)?$/Si:#:{
  if ($regex($2,/^-c(#.*)$/S)) {
    if (!$chan($regml(1))) {
      .notice $nick [ERR]: Not in specified channel.
      halt
    }
    else {
      var %c = $regml(1)
      tokenize 32 $1 $3-
    }
  }
  if (!$2) .notice $nick [ERR]: Insufficient parameters.
  elseif (*!*@* !iswm $2) .notice $nick [ERR]: Invalid hostmask.
  elseif ($iif(%c,$ialchan($2,%c,0),$ial($2,0)) == 0) .notice $nick [ERR]: No users matching hostmask $+(found,$iif(%c,in specified channel),.)
  else {
    .notice $nick Listing users matching hostmask $2 $iif(%c,in specified channel) $+([,$iif(%c,$ialchan($2,%c,0),$ial($2,0)) in total]:    
    var %a = 1
    while ($iif(%c,$ialchan($2,%c,%a).nick,$ial($2,%a).nick)) {
      var %n = %n $v1
      if ($numtok(%n,32) == 8) {
        .notice $nick $replace(%n,$chr(32),$+($chr(44),$chr(32)))
        var %n
      }
      inc %a
    }
    if (%n) .notice $nick $replace(%n,$chr(32),$+($chr(44),$chr(32)))
    .notice $nick End of list.
  }
}