Code: Select all
# set allow nicks
set bv_nicks {"john" "paddy"}
# Set allow versions
set bv_versions {"version1" "version2"}
bind raw - NOTICE Client_Connect
bind ctcr - VERSION ctcr:bv_ctcp
proc Client_Connect {from key arg} {
putserv "PRIVMSG $from :\001VERSION\001"
}
proc ctcr:bv_ctcp {nick host hand dest key arg} {
global bv_versions bv_nicks
if {![isbotnick $nick]} {
foreach nicks $bv_nicks {
if {![string match -nocase "$nicks"]} {
return 0
}
foreach version $bv_versions {
if {![string match -nocase "*[string tolower $version]*"]} {
return 0
}
}
putquick "gline $host 30m :Bad Version"
}
}
}
Code: Select all
if {![string match -nocase "$nicks"]} {
Code: Select all
if {![string match -nocase "*[string tolower $version]*"]} {
Code: Select all
% set bv_nicks {"john" "paddy"}
"john" "paddy"
% set nick "something"
something
% lsearch -nocase $bv_nicks $nick
-1
% set nick Paddy
Paddy
% lsearch -nocase $bv_nicks $nick
1
Code: Select all
foreach nicks $bv_nicks {
if {![string match -nocase "$nicks"]} {
return 0
}
Code: Select all
% set numbers { 1 2 3 4 5 6 }
1 2 3 4 5 6
% foreach number [split $numbers] {
if {$number == 3} {
continue
}
puts $number
}
1
2
4
5
6
Code: Select all
% foreach number [split $numbers] {
if {$number == 3} {
break
}
puts $number
}
1
2
Code: Select all
if {![isbotnick $nick]} {
Code: Select all
proc Client_Connect {from key arg} {
putserv "PRIVMSG $from :\001VERSION\001"
}
CrazyCat with unrealircd is it possible to choose: if the version is different from ...?CrazyCat wrote:If you use unrealircd, you can use the ban version feature
Code: Select all
set acnick {
"John"
}
bind raw - NOTICE server:notices
proc server:notices {from keyword text} {
global acnick
if {[string match -nocase "*client connecting on*" $text]} {
set nick [lindex [split $text] 9]
set hostmask [lindex [split $text] 10]
foreach i [string tolower $acnick] {
if {![string match -nocase $i $nick]} {
putserv "PRIVMSG $nick :\001VERSION\001"
}
}
return 0
}
if {[string match -nocase "*client connecting at*" $text]} {
set nick [lindex [split $text] 8]
set hostmask [lindex [split $text] 9]
foreach i [string tolower $acnick] {
if {![string match -nocase $i $nick]} {
putserv "PRIVMSG $nick :\001VERSION\001"
}
}
return 0
}
}
set badclient {
"mirc"
}
bind ctcr -|- "VERSION" ctcr:check
proc ctcr:check {nick host hand dest keyword text} {
if {$keyword == "VERSION"} {
foreach checknick $::badclient {
if {[string match -nocase *$checknick* [stripcodes bcruag $text]]} {
putquick "GLINE $host 1h :You match a Bad Client. This is not Permitted on \017\002\00306 $::network. \017 Please Use another Client and Reconnect."
}
}
}
}