Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bind dcc - kb dcc:kb
- proc dcc:kb {from idx args} {
- global lastbind ban-time
- set valid 1
- set isnick 0
- set counter 1
- #check for nick or hostname
- if {[onchan [lindex $args 0]]} {
- set host [maskhost [getchanhost [lindex $args 0]] 2]
- set isnick 1
- } else {
- set host [lindex $args 0]
- }
- #check for channel name
- if {[validchan [lindex $args 1]]} {
- set chan [lindex $args 1]
- incr counter
- } elseif {[validchan [lindex [console $idx] 0]]} {
- set chan [lindex [console $idx] 0]
- } else {
- set valid 0
- }
- if {$valid eq 1} {
- if {[string match %* [lindex $args $counter]]} {
- set duration 0
- set s [string range [lindex $args $counter] 1 e]
- if {$s ne 0} {
- set days [lindex [regexp "(\[0-9\]+)+d" $s] 1]
- if {$days ne ""} { incr duration $days*1440 }
- set hours [lindex [regexp "(\[0-9\]+)+h" $s] 1]
- if {$hours ne ""} { incr duration $hours*60 }
- set minutes [lindex [regexp "(\[0-9\]+)+m" $s] 1]
- if {$minutes ne ""} { incr duration $minutes }
- }
- incr counter
- } else {
- set duration ${ban-time}
- }
- }
- if {$valid eq 1} {
- set reason [lrange $args $counter e]
- if {$reason eq ""} { set reason "Requested" }
- if {![matchattr [idx2hand $idx] o|o $chan]} {
- putdcc $idx "Sorry, but you do not have enough access to perform this command"
- return 0
- }
- if {$isnick eq 1} {
- putserv [format "KICK %s %s :%s" $chan $nick $reason]
- } else {
- foreach user [chanlist $chan] {
- if {[matchaddr [getchanhost $user] $host]} {
- putserv [format "KICK %s %s :%s" $chan $user $reason]
- }
- }
- }
- newchanban $chan $host [idx2hand $idx] $reason $duration
- } else {
- putdcc $idx [format "Usage: .%s <nick|hostmask> \[channel\] \[%s<XdXhXm>\] \[reason\]" $lastbind "%"]
- return 0
- }
- return 1
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement