From eb4eaa5f637892f36ce8113163351d1f44ac4051 Mon Sep 17 00:00:00 2001 From: aleteoryx Date: Wed, 6 Nov 2024 13:56:11 -0500 Subject: [PATCH] interceptors working --- irc.tcl | 6 +++--- main.tcl | 16 +++++++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/irc.tcl b/irc.tcl index 9b8dd11..7e44281 100644 --- a/irc.tcl +++ b/irc.tcl @@ -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 diff --git a/main.tcl b/main.tcl index 8a86524..74f6ceb 100755 --- a/main.tcl +++ b/main.tcl @@ -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]] -- 2.45.2