All pastes #752858 Raw Edit

Unnamed

public text v1 · immutable
#752858 ·published 2007-10-28 19:51 UTC
rendered paste body
bind pub - !xaccess pub:xaccess

proc pub:xaccess {nick uhost hand chan rest} {
  catch {
    if {$rest == ""} {
      set target $chan
      set rest "*"
    } else {
      set target [lindex [split $rest " "] 0]
      set rest [join [lrange [split $rest " "] 1 end]
    }
    putquick "PRIVMSG x :access $target $rest"
    putlog "Asking X for access on $target for $chan "
    set ::xaccessnick $nick
    set ::xaccesschan $chan
    return 0
   } foo
 if {$foo != 0} {putlog "Error in pub:xaccess! ($foo)"}
}

bind raw - NOTICE rawnotice:xaccess
proc rawnotice:xaccess {from key rest} {
  if {![info exists ::xaccessnick]} {return} {set nick $::xaccessnick}
  catch {
    if {$from == "X!cservice@undernet.org"} {
      putlog "Notice from $from key($key) rest($rest)"
      #if {[lindex $rest 1] == ":Channel"} {set ::xaccesschan [lindex $rest 2]; putlog "xaccess chan [lindex $rest 2]"}
      if {[lindex $rest 1] == ":Access:"} {
        puthelp "NOTICE $nick :\0035- X - [access [lrange $rest 2 end]]"
      }
      if {[string first {doesn't appear to be registered} $rest] != -1} {
        puthelp "NOTICE $nick :\0035[lindex $rest 3] isn't registered with X"
      }
      if {[string first {insufficient access} $rest] != -1} {
        putserv "NOTICE $nick :\0035I dont have X access to that channel"
      }
    }
    return 0
  } foo
  if {$foo != 0} {
     putlog "Error in notice:xaccess! ($foo)"
     puthelp "NOTICE $nick :Error in notice:xaccess! ($foo)"
  }
}