All pastes #760326 Raw Edit

Untitled

public text v1 · immutable
·published 2007-11-03 22:27 UTC
rendered paste body
alias dns { %s.dns = $ctime | %dns = $1 | .dns $1- }

ON *:DNS:{
  if ($dns(0) == 0) {
  msg %channel $c1([) $+ $c2(DNS) $+ $c1(]:) $c1(couldn't resolve) $c2($iif($iaddress,$iaddress,$dns(0).addr)) $+ $c1(.) | unset %dns | haltdef }
  else {
    var %numhosts $dns(0), %host = 0
    var %hosts
    while (%host < %numhosts) {
      inc %host 1
      set %hosts %hosts $iif($dns(1) == $dns(1).ip,$dns(%host).addr,$dns(%host).ip) $+ $chr(44)
    }
    m %channel $c1([) $+ $c2(DNS) $+ $c1(]:) $c2($dns(1)) $c1(->) $c2($left(%hosts,$calc($len(%hosts)-1)))
    unset %dns
    haltdef
  }
}
on $*:text:/^[!@.`](dns|resolve)/Si:#: {
  /set %channel $chan
  /dns $2-
}