~aleteoryx/tclircc

eb4eaa5f637892f36ce8113163351d1f44ac4051 — aleteoryx a month ago 1db2f6c
interceptors working
2 files changed, 16 insertions(+), 6 deletions(-)

M irc.tcl
M main.tcl
M irc.tcl => irc.tcl +3 -3
@@ 19,9 19,9 @@
package require Thread

namespace eval ::irc {
  variable log [logger::init tclircc::irc]
  variable logd [logger::init tclircc::irc::dispatch]
  variable logp [logger::init tclircc::irc::proto]
  variable log [logger::init irc]
  variable logd [logger::init irc::dispatch]
  variable logp [logger::init irc::proto]
  variable chan.meta
  variable chan.handlers
  variable chan.interceptors

M main.tcl => main.tcl +13 -3
@@ 7,13 7,23 @@ set log [logger::init tclircc]
source irc.tcl
source cap.tcl

#puts "connecting to testnet.ergo.chat"
#set chan [irc::connect testnet.ergo.chat 6697 1]
set chan [irc::connect localhost 8000 0]
puts "connecting to testnet.ergo.chat"
set chan [irc::connect testnet.ergo.chat 6697 1]
#set chan [irc::connect localhost 8000 0]

irc::handler add $chan * {
  ${log}::debug [dict get $dispatch rawmsg]
}

proc nocap {dispatch} {
  if {[dict get $dispatch cmd] == "CAP"} {
    uplevel #0 {${log}::info "GET TROLLED, CAP BLOCKED"}
    return true
  }
}

irc::interceptor add $chan nocap

#irc::handler add $chan CAP {
#  ${log}::debug "parsing cap ls"
#  set parsed [cap::parse_msg [dict get $dispatch params]]