1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# blacklist.tcl # version 1.3 # caesar <cezarica@prietenii.com> # #eggdrop @ Undernet.org # http://www.geocities.com/caesartcl/ ## # Desc: # A simple and efficient channel blacklist. ## ## # Features: # Now accepts commands from a channel to another channel, eg: from #foo channel add for #bla channel # a mask in the blacklist: .black add #bla *!*@something.com ### # ### #### Do not edit past here unless you know TCL! ### # # binds # bind pub m|m .black pub:blacklist # blacklist # proc pub:blacklist {nick uhost handle chan arg} { set type [lindex $arg 0] if {$type == ""} { putserv "NOTICE $nick :Usage: .black <add|del|list>" return } switch -- $type { "add" { if {[lindex $arg 2] == ""} { putserv "NOTICE $nick :Usage: .black add <nick|mask> <reason>" return } if {![string match "*@*" [lindex $arg 1]]} { set who [lindex $arg 1] set reason [lrange $arg 2 end] if {$who == $::botnick} { putserv "NOTICE $nick :lmao!" return } if {![onchan $who $chan]} { putserv "NOTICE $nick :Sorry, I don't see $who in $chan channel." return } { scan [getchanhost $who $chan] "%\[^@\]@%s" user host newban *!*@$host $nick "$reason" 0 putserv "NOTICE $nick :Added $who (*!*@$host) in to the blacklist." return } } if {[string match "*@*" [lindex $arg 1]]} { set what [lindex $arg 1] set reason [lrange $arg 2 end] if {[string match "$what" "$::botname"]} { putserv "NOTICE $nick :Sorry, can't add $what ban because it matches my host." return } newban $what $nick "$reason" 0 putserv "NOTICE $nick :Added $what in blacklist." return } } "del" { if {[lindex $arg 1] == ""} { putserv "NOTICE $nick :Usage: .black del <mask>" return } set ban [lindex $arg 1] if {[matchban $ban]} { killban $ban putserv "NOTICE $nick :Removed $ban from blacklist." return } putserv "NOTICE $nick :Sorry, but I don't have $ban in blacklist." } "list" { set num 1 putserv "NOTICE $nick :Global blacklist:" foreach cblist [banlist] { set ban [lindex $cblist 0] set reason [lindex $cblist 1] set type [lindex $cblist 2] set user [lindex $cblist 5] putserv "NOTICE $nick :\002Ban $num\002: $ban \002Type\002: $type \002Reason\002: $reason \002By\002: $user." incr num } if {$num == 1} { putserv "NOTICE $nick :Sorry, the blacklist is empty." } } } } putlog "blacklist.tcl.. loaded" |
| Parsed for bracket errors and indented: | |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# blacklist.tcl # version 1.3 # caesar <cezarica@prietenii.com> # #eggdrop @ Undernet.org # http://www.geocities.com/caesartcl/ ## # Desc: # A simple and efficient channel blacklist. ## ## # Features: # Now accepts commands from a channel to another channel, eg: from #foo channel add for #bla channel # a mask in the blacklist: .black add #bla *!*@something.com ### # ### #### Do not edit past here unless you know TCL! ### # # binds # bind pub m|m .black pub:blacklist # blacklist # proc pub:blacklist {nick uhost handle chan arg} { set type [lindex $arg 0] if {$type == ""} { putserv "NOTICE $nick :Usage: .black <add|del|list>" return } switch -- $type { "add" { if {[lindex $arg 2] == ""} { putserv "NOTICE $nick :Usage: .black add <nick|mask> <reason>" return } if {![string match "*@*" [lindex $arg 1]]} { set who [lindex $arg 1] set reason [lrange $arg 2 end] if {$who == $::botnick} { putserv "NOTICE $nick :lmao!" return } if {![onchan $who $chan]} { putserv "NOTICE $nick :Sorry, I don't see $who in $chan channel." return } { scan [getchanhost $who $chan] "%\[^@\]@%s" user host newban *!*@$host $nick "$reason" 0 putserv "NOTICE $nick :Added $who (*!*@$host) in to the blacklist." return } } if {[string match "*@*" [lindex $arg 1]]} { set what [lindex $arg 1] set reason [lrange $arg 2 end] if {[string match "$what" "$::botname"]} { putserv "NOTICE $nick :Sorry, can't add $what ban because it matches my host." return } newban $what $nick "$reason" 0 putserv "NOTICE $nick :Added $what in blacklist." return } } "del" { if {[lindex $arg 1] == ""} { putserv "NOTICE $nick :Usage: .black del <mask>" return } set ban [lindex $arg 1] if {[matchban $ban]} { killban $ban putserv "NOTICE $nick :Removed $ban from blacklist." return } putserv "NOTICE $nick :Sorry, but I don't have $ban in blacklist." } "list" { set num 1 putserv "NOTICE $nick :Global blacklist:" foreach cblist [banlist] { set ban [lindex $cblist 0] set reason [lindex $cblist 1] set type [lindex $cblist 2] set user [lindex $cblist 5] putserv "NOTICE $nick :\002Ban $num\002: $ban \002Type\002: $type \002Reason\002: $reason \002By\002: $user." incr num } if {$num == 1} { putserv "NOTICE $nick :Sorry, the blacklist is empty." } } } } putlog "blacklist.tcl.. loaded" |