Welcome, and sorry for the delay.
It should be fixed now, or at least it worked for me
Code
Code: Select all
# sbx.tcl by TCL_no_TK
set sbx_version "1.3b"
#
# Version 2 of sbx.tcl.
# This script "sends" new channel bans to X (As long as X is on the channel).
# Depending if +sbx-enable is a valid option on the channel.
# This script relays on the same "per channel" options as sbx.tcl version 1 dose.
# Please see the syntax from version 1 below.
#
# Usage: (in DCC/telnet)
#
# .chanset <#channel> +sbx-enable - will enable the script on the given channel.
# .chanset <#channel> -sbx-enable - will disable the script.
# .chanset <#channel> sbx-duration <hours> - sets the ban duration, in hours for this channel.
# .chanset <#channel> sbx-level <level> - sets the ban level, for this channel.
# .chanset <#channel> sbx-reason <reason> - sets the ban reason, to use when adding the bans
# to X for this channel.
#
# see http://cservice.undernet.org/docs/xcmds.txt for help when setting the script.
# Usage: (in DCC/telnet)
#
##
set ban-default-level "500" ;# The default ban level for the ban command in X.
set ban-default-reason "Requested" ;# The default ban reason for the ban command in X.
if {([info commands old_newchanban] != "old_newchanban")} {
rename newchanban old_newchanban
}
proc newchanban {channel ban creator {comment ""} {lifetime ""} {options ""}} {
global ban-default-level ban-default-reason
set syntax "ban"
if {($channel != "") && ($ban != "")} {
if {(![validchan "$channel"])} {
error "invalid channel: $channel"
}
if {(![string match "*!*@*" "$ban"])} {
set _ban "$ban!*@*"
} else {
set _ban "$ban"
}
if {(![channel get "$channel" "sbx-enable"])} {
if {($lifetime != "") && ($options != "")} {
return [old_newchanban $channel $ban $creator "$comment" $lifetime $options]
} elseif {($lifetime != "") && ($options == "")} {
return [old_newchanban $channel $ban $creator "$comment" $lifetime]
} elseif {($lifetime == "") && ($options != "")} {
return [old_newchanban $channel $ban $creator "$comment" $options]
} else {
return [old_newchanban $channel $ban $creator "$comment"]
}
}
if {([bansme "$ban"])} {
putlog "Wanted to ban myself--deflected."
return
}
append syntax " $channel $ban"
if {($lifetime != "") && ($lifetime != "0")} {
append syntax " $lifetime"
} else {
if {(([channel get "$channel" "sbx-duration"] != ""))} {
append syntax " [channel get "$channel" "sbx-duration"]"
}
}
if {([channel get "$channel" "sbx-level"] != "")} {
append syntax " [channel get "$channel" "sbx-level"]"
} else {
if {([info exists ban-default-level]) && (${ban-default-level} != "")} {
append syntax " ${ban-default-level}"
}
}
if {($comment != "")} {
append syntax " $comment"
} elseif {([channel get "$channel" "sbx-reason"] != "")} {
append syntax " [channel get "$channel" "sbx-reason"]"
} elseif {([info exists default-ban-reason]) && (${default-ban-reason} != "")} {
append syntax " ${default-ban-reason}"
} else {
append syntax " no reason"
}
if {([xonchan "$channel"])} {
puthelp "PRIVMSG X@channels.undernet.org :$syntax"
return
} else {
if {($lifetime != "") && ($options != "")} {
return [old_newchanban $channel $ban $creator "$comment" $lifetime $options]
} elseif {($lifetime != "") && ($options == "")} {
return [old_newchanban $channel $ban $creator "$comment" $lifetime]
} elseif {($lifetime == "") && ($options != "")} {
return [old_newchanban $channel $ban $creator "$comment" $options]
} else {
return [old_newchanban $channel $ban $creator "$comment"]
}
}
} else {
error "wrong # args: should be \"newchanban channel ban creator comment ?lifetime? ?options?\""
}
}
# used for checking if we are banning are selfs.
proc bansme {ban} {
global botnick botname
if {([string match -nocase "*$botname" "$ban"]) || ([string match -nocase "*$botnick*!*@*" "$ban"])} {
return 1
}
return 0
}
# used for checking if X is on the channel or not.
proc xonchan {channel} {
if {([onchan "X" "$channel"])} {
return 1
} else {
return 0
}
}
setudef flag sbx-enable
setudef str sbx-duration
setudef str sbx-reason
setudef str sbx-level
putlog "loaded sbx-v2.tcl version $sbx_version by TCL_no_TK"
return