Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
floodprotection.tcl - Allows users to diable flood protection
Author Message
Kunsi Offline
Bastard Operator from Hell
*******

Posts: 68
Joined: May 2010
Reputation: 0
Post: #1
floodprotection.tcl - Allows users to diable flood protection
Quote:/sbnc set floodprotection (off|on)
Enables/diables flood protection

Code:
internalbind command floodcontrol:commands
internalbind attach floodcontrol:attach

proc floodcontrol:replyset {params} {
    setctx [lindex $params 0]
    
    bncreply "floodcontrol - [lindex $params 2]"
}

proc floodcontrol:commands {client params} {
    if {[string equal -nocase [lindex $params 0] "set"]} {
        if {[llength $params] < 3} {
            if {[getbncuser $client tag floodcontrol]} {
                set floodcontrol "Off"
            } else {
                set floodcontrol "On"
            }

            internaltimer 0 0 floodcontrol:replyset [list [getctx 1] $floodcontrol]
            
            return
        }

        if {[string equal -nocase [lindex $params 1] "floodcontrol"]} {
            if {[string tolower [lindex $params 2]] == "off"} {
                setbncuser $client tag floodcontrol 1
                bncreply "Done."
            } else {
                setbncuser $client tag floodcontrol 0
                bncreply "Done."
            }
            
            haltoutput
        }
    }
}

proc floodcontrol:attach {client} {
    if {[getbncuser $client tag floodcontrol] == 1} {
        floodcontrol off
        
        bncnotc "Floodprotection has been disabled for this connection."
    }
}

proc iface-floodcontrol:get {} {
    if {[getbncuser [getctx] tag floodcontrol] == 1} {
        set result 0
    } else {
        set result 1
    }
    
    return [itype_string $result]
}

if {[info commands "registerifacecmd"] != ""} {
    registerifacecmd "floodcontrol" "floodctrl-get" "iface-floodcontrol:get"
}

proc iface-floodcontrol:set {value} {
    if {[string tolower $value] == "off" || $value == 0} {
        setbncuser [getctx] tag floodcontrol 1
    } else {
        setbncuser [getctx] tag floodcontrol 0
    }
    
    return [itype_string 1]
}

if {[info commands "registerifacecmd"] != ""} {
    registerifacecmd "floodcontrol" "floodctrl-set" "iface-floodcontrol:set"
}
(This post was last modified: 15.08.2010 09:59 by Kunsi.)
22.07.2010 17:09
kunsi1990 Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  delbouncer.tcl - Allows users to delete their Bouncers. Kunsi 0 799 18.07.2010 14:33
Last Post: Kunsi

Forum Jump:


Contact Us | shroudBNC Home | Return to Top | Return to Content | Lite (Archive) Mode | RSS Syndication