#### # AUTHOR: # AltBlue http://altblue.n0i.net ### # DESCRIPTION: # this make our bot spit our rules out ;-] #### # CHANGELOG: # * 2000.12.08: # - initial version #### # flood protection, in the form x:y. Any queries beyond x in y seconds is considered a flood and ignored. set rules(flood) 4:15 # switch for ignoring flooders (1=on) set rules(ignore) 1 # define the amount of time a flooder is ignored (minutes). # (this is meaningless if abd(ignore) is 0) set rules(ignore_time) 2 ################################# # RULES ############### set rules_global { {Do not ask for ops.} {Do not flood. Do not paste more than 3 lines in a throw.} {Do not repeat.} {Do not speak in ALL CAPS.} {No away timers. No timers in general. Timers SUCK bigtime!} {No cloning: 2 connections per user should be enough for everybody.} {No colliding.} {No fake usernames.} {No mIRC colours.} {No nuking or other DoS attacks.} {No ON JOINs of any kind.} {No spoofing.} {No user harassment.} {BEHAVE!} } set rules_support { {Ask for permission to message someone (especially an op).} {Do not ask to ask a question. Just tell us your problem.} {Do not expect us to configure your system for you.} {Do not expect us to think for you.} {Do not expect us to write programs for you.} {Do not say ''it doesn't work.'' That is not helpful in any way. Tell us what didn't happen that you expected, or what did happen that you didn't expect.} {Read the documentation and FAQ when we ask (or tell) you to.} {Tell us the error message you get. Before asking look for typos, unmatched quotes, missing semicolons, trailing garbage etc.} {We are not here to help you with the crappy script you downloaded.} } set rules_noi { {Don't ask why you got kicked. You will get banned, permbanned eventually or even killed. Our snippers are watching you!} {We don't want strangers here. Set your IRCNAME as your Real Name if you still want something from us and only after that join the channel.} } set rules_linux { {Do not ask us about microsoft stuff, os/2 or got know what else... let's say only other *NIX are accepted.} } ########################################### #### BE SMART! Don't modify anything below. ################################################################## set rules(version) "N0i.Net Rules Pack v1.0" ########## Flood Protection proc rules_flood {nick uhost} { global rules rules_flood_array if {$rules(flood_num) == 0} {return 0} set i [expr $rules(flood_num) - 1] while {$i >= 1} { set rules_flood_array($i) $rules_flood_array([expr $i - 1]) incr i -1 } set rules_flood_array(0) [unixtime] if {[expr [unixtime] - $rules_flood_array([expr $rules(flood_num) - 1])] <= $rules(flood_time)} { putlog "$rules(version): Flood detected from $nick." if {$rules(ignore)} { newignore [join [maskhost *!*[string trimleft $uhost ~]]] $rules(version) flood $rules(ignore_time) } return 1 } {return 0} } proc rules_flood_init {} { global rules rules_flood_array if {![string match *:* $rules(flood)]} { putlog "$rules(version): var rules(flood) not set correctly." return 0 } set rules(flood_num) [lindex [split $rules(flood) :] 0] set rules(flood_time) [lindex [split $rules(flood) :] 1] set i [expr $rules(flood_num) - 1] while {$i >= 0} { set rules_flood_array($i) 0 incr i -1 } } rules_flood_init ################################################### ## routines ########### proc rules_get {channel {ruleno 0}} { global rules_global rules_noi rules_support rules_linux if { $channel == "global" } { set rules $rules_global } elseif { $channel == "noi" } { set rules [concat $rules_noi [concat $rules_support $rules_global]] } elseif { $channel == "support"} { set rules [concat $rules_support $rules_global] } elseif { $channel == "linux" } { set rules [concat $rules_linux [concat $rules_support $rules_global]] } else { return [list "Invalid channel name"] } if { $ruleno == 0 || $ruleno == ""} { return $rules } elseif { [regexp \[^0-9\] $ruleno] } { return [list "Invalid rule number"] } else { set ruleno [expr $ruleno - 1] if { [llength $rules] <= $ruleno || $ruleno < 0 } { return [list "There is no such rule. Use something from 1 to [llength $rules]"] } else { return [list [lindex $rules $ruleno]] } } } bind pub -|- !rule rule_pub proc rule_pub {nick uhost hand chan arg} { if {[rules_flood $nick $uhost]} {return 0} putcmdlog "($chan) $nick: RULE $arg" if { [llength $arg] == 2 } { foreach rule [rules_get [lindex $arg 0] [lindex $arg 1]] { putserv "NOTICE $nick :$rule" } } elseif { [llength $arg] == 1 } { if { $arg == "help" } { putserv "NOTICE $nick :USAGE: !rule \[<channel_name>|global|help\] \[<rule_number>\]" putserv "NOTICE $nick :if you don't specify a <channel_name>, i'll use the current channel," putserv "NOTICE $nick :if you don't specify a <rule_number>, i'll show you all the rules for <channel_name>." putserv "NOTICE $nick :NOTE: you don't have to specify # or & for the <channel_name>." return 0; } if { [regexp \[^0-9\] $arg] } { foreach rule [rules_get $arg 0] { putserv "NOTICE $nick :$rule" } } else { foreach rule [rules_get [string trimleft $chan #+&] $arg] { putserv "NOTICE $nick :$rule" } } } else { foreach rule [rules_get [string trimleft $chan #+&] 0] { putserv "NOTICE $nick :$rule" } } } bind pub o|o !trule rule_spit proc rule_spit {nick uhost hand chan arg} { if {[rules_flood $nick $uhost]} {return 0} putcmdlog "($chan) $nick: TellRULE $arg" if { $arg == "help" } { putserv "NOTICE $nick :USAGE: !trule <nick> \[<channel_name>|global|help\] \[<rule_number>\]" putserv "NOTICE $nick :should be used to make me tell <nick> some rules." putserv "NOTICE $nick :if you don't specify a <channel_name>, i'll use the current channel," putserv "NOTICE $nick :if you don't specify a <rule_number>, i'll show <nick> all the rules for <channel_name>." putserv "NOTICE $nick :NOTE: you don't have to specify # or & for the <channel_name>." return 0; } set luzer [lindex $arg 0] if {![onchan $luzer $chan] } { putserv "NOTICE $nick :sucker! whom should i tell the rules?!" return 0 } if { [llength $arg] == 3 } { foreach rule [rules_get [lindex $arg 1] [lindex $arg 2]] { putserv "NOTICE $luzer :$rule" } } elseif { [llength $arg] == 2 } { if { [regexp \[^0-9\] [lindex $arg 1]] } { foreach rule [rules_get [lindex $arg 1] 0] { putserv "NOTICE $luzer :$rule" } } else { foreach rule [rules_get [string trimleft $chan #+&] [lindex $arg 1]] { putserv "NOTICE $luzer :$rule" } } } else { foreach rule [rules_get [string trimleft $chan #+&] 0] { putserv "NOTICE $luzer :$rule" } } }