proc h:join {nick host hand chan text} {
set host [lindex [split $host "@"] 1]
if {[checkexcept $host]} { return 0 }
if {[string match -nocase *users.quakenet.org* $host]} {
return 0
}
if {[string is digit -strict [string range $nick end-1 end]] || [string match -nocase {*[bcdfghjklmnpqrstvxyz]*} "$nick"]} {
putserv "NOTICE $nick :You are infected with an IRC trojan, if this is not true, /msg $::botnick delete and change your nickname without two numbers."
varin /home/rt/stats $host "\002Stats for $host:\002 added by :$::botnick - channel: n/a"
varin /home/rt/stats $chan "$::botnick [incr [varout /home/rt/stats $chan] 1]"
dccbroadcast "(\002$host\002) has been added to the antipjen pjen db."
}
}
awyeah, you are doing everything possible to prove that Tcl could be wtite-only language too, just like Perl
not only your ifs are awful and almost impossible to read, they are also inefficient, with all those deeply nested mixed string/list operations; you are in dire need to cleanup your scripting style (please don't take offense)
Well yeah this piece of code is quite complicated because I have used string range especially in here. Somtimes I too get confused because of the length of the conditions. But then again my conditions have more checks than Sir_Fz's script's w32.aplore script.
Try the script and you will see no error. This script has a 100% success rate and 0% error rate -- I've used it alot myself so I know. The logic coded is as same as Oz Script, but turned into TCL. Well the more conditions you have the more less likely you would be kicking out innocent users.
Then again there are only 2 if statements for condition checking. You can merge them into one if you don't like two, but it all gets messy the more the longer the condition statements are.
·awyeah·
==================================
Facebook: jawad@idsia.ch (Jay Dee) PS: Guys, I don't accept script helps or requests personally anymore.
==================================
the point is not whether your script works or not, the point is to produce readable, understandable and easily maintainable source code; If you ever get involved in professional software development, you'll know what I mean
Sir_Fz wrote:You're saying that it's Oz's addon translated into Tcl, well that's exactly what my code is.
I use your code my friend. Purrfect! Is simple too, which can only be good.
demond wrote:the point is not whether your script works or not, the point is to produce readable, understandable and easily maintainable source code; If you ever get involved in professional software development, you'll know what I mean
Couldn't agree more. Using the KISS (Keep It Simple Stupid) principle, a simple 'one-liner' does exactly what some spend 80 or so lines on. I cannot fathom the reasoning behind such bloated coding.
Add [SOLVED] to the thread title if your issue has been. Search | FAQ | RTM
###################################################################
# #
# Coded by: Opposing (Fz@nexushells.net) - #nexushells @ DALnet #
# Version: 1.0 #
## #
# Description: Bankicks nicks who are suspicious of being #
# infected with w32.aplore@mm Trojan/Virus/Worm. #
# Translated from the Oz mirc addon. #
# #
# Report bugs/suggestions to Fz at nexushells.net #
###################################################################
#
##############################
# Configurations start here: #
# __________________________ #
## Set the channels you want this script to work on.
## example: set aplore(chans) "#chan1 #chan2" (in lowercase)
set aplore(chans) "#chan1 #chan2"
## Set the kick message.
set aplore(kmsg) "w32.aplore@mm Trojan/Virus/Worm Infected."
## Set, in minutes, ban time for this offence.
set aplore(btime) "30"
# Configurations end here. #
############################
#
######################################################################
# Code starts here, please do not edit anything unless you know TCL: #
# __________________________________________________________________ #
bind join - * aplore:kick
proc aplore:kick {nick uhost hand chan} {
global aplore
set aplorenick 0
if {([string is alpha $nick]) || ([string match *\[-^`_\]* $nick]) || ([lsearch -exact $aplore(chans) [string tolower $chan]] == -1)} { return 0 }
scan $uhost %\[^@\]@%s ident host
if {([string match -nocase "*[set sident [string trimleft $ident ~]]*" $nick]) && ([string is alpha [string range $nick 0 3]]) && ([string is integer [string range $nick end-1 end]]) && ([string is integer [string index $sident end]]) && ([string index $ident 0] == "~")} {
putquick "KICK $chan $nick :$aplore(kmsg)"
putquick "MODE $chan +b *!*@$host"
putlog "\002$nick\002!\002$ident\002 is infected with w32.aplore@mm."
}
}
putlog "w32.aplore@mm bankick v1.0 by Opposing Loaded..."
Can be configured for more than one channel via 'set aplore(chans)'
Add [SOLVED] to the thread title if your issue has been. Search | FAQ | RTM
###################################################################
# #
# Coded by: Opposing (Fz@nexushells.net) - #nexushells @ DALnet #
# Version: 1.0 #
## #
# Description: Bankicks nicks who are suspicious of being #
# infected with w32.aplore@mm Trojan/Virus/Worm. #
# Translated from the Oz mirc addon. #
# #
# Report bugs/suggestions to Fz at nexushells.net #
###################################################################
#
##############################
# Configurations start here: #
# __________________________ #
## Set the channels you want this script to work on.
## example: set aplore(chans) "#chan1 #chan2" (in lowercase)
set aplore(chans) [channels]
## Set the kick message.
set aplore(kmsg) "w32.aplore@mm Trojan/Virus/Worm Infected."
## Set, in minutes, ban time for this offence.
set aplore(btime) "30"
# Configurations end here. #
############################
#
######################################################################
# Code starts here, please do not edit anything unless you know TCL: #
# __________________________________________________________________ #
bind join - * aplore:kick
proc aplore:kick {nick uhost hand chan} {
global aplore
set aplorenick 0
if {([string is alpha $nick]) || ([string match *\[-^`_\]* $nick]) || ([lsearch -exact $aplore(chans) [string tolower $chan]] == -1)} { return 0 }
scan $uhost %\[^@\]@%s ident host
if {([string match -nocase "*[set sident [string trimleft $ident ~]]*" $nick]) && ([string is alpha [string range $nick 0 3]]) && ([string is integer [string range $nick end-1 end]]) && ([string is integer [string index $sident end]]) && ([string index $ident 0] == "~")} {
putquick "KICK $chan $nick :$aplore(kmsg)"
putquick "MODE $chan +b *!*@$host"
putlog "\002$nick\002!\002$ident\002 is infected with w32.aplore@mm."
}
}
putlog "w32.aplore@mm bankick v1.0 by Opposing Loaded..."