Permalink
Browse files

Updated [ProcessKick] to eggdrop spec, removed bind types that weren'…

…t actually supported, and removed default variable for [::bind], as this served no purpose.
  • Loading branch information...
1 parent 4f94213 commit 4786b743cd847b10b17db6ea40deb2ede104f5d6 @blackwind blackwind committed Apr 18, 2012
Showing with 9 additions and 9 deletions.
  1. +9 −9 modules/modtcl/binds.tcl
View
@@ -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"}}

0 comments on commit 4786b74

Please sign in to comment.