All pastes #752913 Raw Edit

Untitled

public text v1 · immutable
#752913 ·published 2007-10-28 20:35 UTC
rendered paste body

# xstatus.tcl
# author: simple@Undernet/#TCL skralg@gmail.com
# date: 19OCT2007
# purpose: display Undernet channel status via X service

bind pub - !xcommands pub:xshowcommands
proc pub:xshowcommands {nick uhost hand chan rest} {
 catch {
  if {$rest == ""} {set target $chan} else {set target [lindex $rest 0]}
  putquick "PRIVMSG x :showcommands $target"
  putlog "Asking X for commands on $target for $nick ($hand)"
  set ::xshowcommandschan $chan
  set ::xshowcommandsnick $nick
  return 0
 } foo
 if {$foo != 0} {putlog "Error in pub:xcommands! ($foo)"}
}

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