bind join - * join:nospam
proc join:nospam {nick host hand chan} {
set ident [string range $host [string first ! $host] [string first @ $host]]
if {[string match [a-z] [string index $ident 0] == 1] && [string match [0-9] [string index $ident 1] == 1] && [string match [a-z] [string index $ident 2] == 1] && [string match [0-9] [string index $ident 3] == 1] && [string match [a-z] [string index $ident 4] == 1]} {
putserv "KICK $chan $nick :Spamming ident."
newban [string trimleft [maskhost [getchanhost $nick $chan]] ~] NoSpam "Spamming ident." $spambantime
}
}
Basically, I want to kick and ban any user with the alpha-number-alpha-number-alpha type ident (i.e. o1j2e).
This is a widely used type of spamming ident on Austnet and the ident always follows such a pattern. It would be nice to get this working.
if {[string match \[a-z\] [string index $ident 0] == 1] && [string match \[0-9\] [string index $ident 1] == 1] && [string match \[a-z\] [string index $ident 2] == 1] && [string match \[0-9\] [string index $ident 3] == 1] && [string match \[a-z\] [string index $ident 4] == 1]} {
[string match \[a-z\] [string index $ident 0] == 1]
Now, the way you have that written, these are the arguments:
match
\[a-z\]
[string index $ident 0]
==
1
Tcl is treating "==" as a string argument to the command, because it's inside the [ ] with the rest of the parameters. Probably you meant for the ] after the 1 to actually be before the ==.
Do yourself a favor and split that horrible mess into a couple different lines heh. Also take a look at what User said.