All pastes #203069 Raw Edit

Unnamed

public text v1 · immutable
#203069 ·published 2006-10-14 22:25 UTC
rendered paste body
on 400:text:*aop*:#: {
  if $1 == .aop {
    if !$2 && $2 !== - && $2 !== + && $2 !== list { .notice $nick Error. Syntax: .aop +/- <nick> | halt }
    if $2 == + {
      if !$3 { .notice $nick No user specified. | halt }
      if !$3 { .notice $nick User is not on $chan $+ . | halt }
      var %host = $address($3,2)
      var %chan = $chan
      var %file = autoop- $+ $chan $+ .txt
      if ($read(%file,%host) !== $null) { .notice $nick Error. User already has autoop for $chan $+ . | halt }
      write %file %host %chan
      notice $nick Added %host to %chan $+ 's autoop list.
    }
    if $2 == - {
      if !$3 { .notice $nick No host specified. | halt }
      var %host = $3
      var %chan = $chan
      var %file = autoop- $+ $chan $+ .txt
      if ($read(%file,n,%host) == $null) { .notice $nick %host doesn't exist in autoop list for $chan $+ . }
      if ($read(%file,n,%host) !== $null) {
        write -dl $+ $readn %file
        notice $nick Removed %host from %chan $+ 's autoop list. 
      }
    }
    if $2 == list {
      var %file = autoop- $+ $chan $+ .txt
      if $lines(%file) == 0 { .notice $nick There are no entries for $chan $+ . | halt }
      msg $nick === Autoop list for $chan ===
      play $nick %file 2500
    }
  }
}
on *:join:#: {
  if $me isop $chan {
    var %file = autoop- $+ $chan $+ .txt
    var %host = $address($nick,2)
    if $gettok($read(%file,n,%host),2,32) == $chan { mode $chan +o $nick }
  }
}