From 4786b743cd847b10b17db6ea40deb2ede104f5d6 Mon Sep 17 00:00:00 2001 From: blackwind Date: Wed, 18 Apr 2012 04:11:03 -0600 Subject: [PATCH] Updated [ProcessKick] to eggdrop spec, removed bind types that weren't actually supported, and removed default variable for [::bind], as this served no purpose. --- modules/modtcl/binds.tcl | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/modules/modtcl/binds.tcl b/modules/modtcl/binds.tcl index a55cc5c6..f7cc6aaa 100644 --- a/modules/modtcl/binds.tcl +++ b/modules/modtcl/binds.tcl @@ -6,7 +6,7 @@ # # Binds module to process incoming messages with ZNC modtcl # -# Supported bind types: pub/pubm, msg/msgm, time, evnt, nick, bot, dcc, kick +# Supported bind types: bot, dcc, evnt, kick, msg, msgm, nick, pub, pubm, time # evnt: prerehash,rehash,init-server,disconnect-server # @@ -19,15 +19,11 @@ namespace eval Binds { # procs proc Add {type flags cmd {procname ""}} { - if {![regexp {^(pub|pubm|msg|msgm|nick|mode|raw|bot|time|evnt|dcc|kick)$} $type]} { + if {![regexp {^(bot|dcc|evnt|kick|msg|msgm|nick|pub|pubm|time)$} $type]} { PutModule "Tcl error: Bind type: $type not supported" return } # ToDo: Flags check from user info (IsAdmin, etc) - if {$procname == ""} { - PutModule "Tcl error: Without a proc binds are useless" - return - } # ToDo: bind hit counter if {[lsearch $Binds::List "$type $flags [list $cmd] 0 [list $procname]"] == -1} { lappend Binds::List "$type $flags [list $cmd] 0 [list $procname]" @@ -127,8 +123,12 @@ namespace eval Binds { proc ProcessKick {nick user handle channel target reason} { foreach n [binds kick] { - if {[string match [lindex $n 2 0] $channel] && [string match [lindex $n 2 1] $target]} { - [lindex $n 4] $nick $user $handle $channel $target $reason + if {[string match [lindex $n 2 0] $channel]} { + if {[llength [lindex $n 2]] <= 1 || [string match [lindex $n 2 1] $target]} { + if {[llength [lindex $n 2]] <= 2 || [string match [lindex $n 2 2] $reason]} { + [lindex $n 4] $nick $user $handle $channel $target $reason + } + } } } } @@ -148,7 +148,7 @@ namespace eval Binds { } # Provide aliases according to eggdrop specs -proc ::bind {type flags cmd {procname ""}} {Binds::Add $type $flags $cmd $procname} +proc ::bind {type flags cmd procname} {Binds::Add $type $flags $cmd $procname} proc ::unbind {type flags cmd procname} {Binds::Del $type $flags $cmd $procname} proc ::binds {{type ""}} {if {$type != ""} {set type "$type "};return [lsearch -all -inline $Binds::List "$type*"]} proc ::bindlist {{type ""}} {foreach bind $Binds::List {PutModule "$bind"}}