All pastes #358179 Raw Edit

Head Start

public text v1 · immutable
·published 2007-02-16 02:52 UTC
rendered paste body
set channelList "#GudHak"
set server1List "swiftirc SwiftIRC DALRelay"
set server2List "dal DALnet STRelay"

proc send_across {cmd chan nick text} {
  global server channelList server1List server2List
  if {[lsearch $channelList [string tolower $chan]] != -1} {
    if  {[string first [lindex $server1List 0] $server] != -1} {
      set fromServer "[lindex $server1List 1]"
      set toBot "[lindex $server1List 2]" 
    } else {
      set fromServer "[lindex $server2List 1]"
      set toBot "[lindex $server2List 2]" 
    }
    set botMsg [concat $cmd $chan $fromServer $nick $text]
    putbot $toBot $botMsg
  }
}

proc send_xnames {nick uhost hand arg} {
  if {$arg == "" || [string first "#" $arg] != 0} {
    putserv "NOTICE $nick :Usage\: /msg Eros xnames #channel"
  } else {
    if {[onchan $nick $arg]} {
      send_across "names" $arg $nick "Xklarx"
    } else {
      putserv "NOTICE $nick :I'm sorry, you must be in the fkn channel $arg to do a remote names (xnames) command"
    }
  }
}
bind msg - xnames send_xnames

proc relay_xnames {frm_bot command arg} {
  set startingChanlist "[chanlist [lindex $arg 0]]" 
  foreach mem $startingChanlist {
    if {[isop $mem [lindex $arg 0]]} {
      lappend finalChanlist \@$mem
    } elseif {[isvoice $mem [lindex $arg 0]]} {
      lappend finalChanlist \+$mem
    } else {
      lappend finalChanlist $mem
    }
  }
  send_across "rnames" [lindex $arg 0] [lindex $arg 2] $finalChanlist
}
bind bot - names relay_xnames