| View previous topic :: View next topic |
| Author |
Message |
Scarpa_SD Voice
Joined: 25 May 2009 Posts: 3
|
Posted: Mon May 25, 2009 5:17 pm Post subject: Proxy check |
|
|
I was trying to edit this script http://jamesoff.net/site/wp-content/uploads/2008/02/proxychecktcl.bz2 to do global bans instead of channel specific ones because a few drones were going into multiple channels and would get 1 line of spam in before the checks went through. I changed the original code that looked like this | Code: | # second callback (catches RBL results)
proc proxycheck_check3 { ip host status nick orighost channel rbl } {
global proxycheck_bantime
if {$status} {
putlog "proxycheck: got host $host = ip $ip from RBL $rbl ... banning"
newchanban $channel "*@$orighost" "proxychk" "proxycheck: $rbl" $proxycheck_bantime
}
#if we didn't get a host, they're not in RBL |
into this | Code: | # second callback (catches RBL results)
proc proxycheck_check3 { ip host status nick orighost channel rbl } {
global proxycheck_bantime
if {([$status]) && (![matchban *@$orighost])} {
putcmdlog "proxycheck: got host $host = ip $ip from RBL $rbl ... banning"
newban "*@$orighost" "proxychk" "proxycheck: $channel $rbl" $proxycheck_bantime
puthelp "PRIVMSG $nick :This is an automated response. You've been banned for $proxycheck_bantime from $channel because your host $host is listed at $rbl"
puthelp "PRIVMSG $nick :You will need to fix whatever caused you to be listed and get removed from $rbl before you're able to rejoin $channel ."
puthelp "PRIVMSG #opschan :$nick was banned from $channel for being listed in $rbl."
}
|
It worked before I tried to cut down the flood it sent by having it only message the ops channel and the user once instead of every time they tried to join a channel my bot has ops in. Now I get this error from the bot [14:17] Tcl error [proxycheck_check3]: invalid command name "0"
If you guys have any ideas on how to fix this I'd be very appreciative. |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Mon May 25, 2009 5:44 pm Post subject: |
|
|
Substituted, evaluated... not interpreted. This works.
| Code: | | if {([$status]) && (![matchban *@$orighost])} { |
Substituted, interpreted, evaluated. This doesn't...
Why? For some reason you put [brackets] around $status as well as the command matchban. This will cause the interpreter to treat their contents as commands. This is fine for matchban, it is a command. But this will happen after substitution of $status with it's value (which in your case, is obviously 0). This is what generates your error (it's trying to invoke the command "0", which of course doesn't exist)...
Simply remove the [ ]'s around $status and it's dandy again...
Edit: bolded the above for added effect  _________________ speechles' eggdrop tcl archive
Last edited by speechles on Mon May 25, 2009 6:34 pm; edited 1 time in total |
|
| Back to top |
|
 |
Scarpa_SD Voice
Joined: 25 May 2009 Posts: 3
|
Posted: Mon May 25, 2009 5:59 pm Post subject: |
|
|
Yeah I can get it to work with But I'm trying to make it not execute anything if the host of the user is already in the banlist.
| Code: | | if {($status) && (![matchban *@$orighost])} { | gives me this
| Quote: | [15:08] Tcl error [proxycheck_check3]: invalid command name "
"
|
I tried | Code: | | if {([$status]) && (![matchban *@$orighost])} { { |
| Code: | | if {[$status] && (![matchban *@$orighost])} { { | ect and every other possibility I could think of.
Can I have a if then statement in an if statement like this?
| Code: | # second callback (catches RBL results)
proc proxycheck_check3 { ip host status nick orighost channel rbl } {
global proxycheck_bantime
if {isban *@$orighost} {}
{
if {$status} {
putlog "proxycheck: got host $host = ip $ip from RBL $rbl ... banning"
newchanban $channel "*@$orighost" "proxychk" "proxycheck: $rbl" $proxycheck_bantime
}
}
#if we didn't get a host, they're not in RBL
}[/quote] |
|
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Mon May 25, 2009 6:28 pm Post subject: |
|
|
| Quote: | I tried
| Code: | | if {([$status]) && (![matchban *@$orighost])} { |
| Code: | | if {[$status] && (![matchban *@$orighost])} { | |
......simply read what I've said, and slow down... We will go 1 step at a time, go back to your original version....
Now....
....Simply remove the [ ]'s around $status and it's dandy again...
Should get you somewhere near here:
| Code: | | if {($status) && (![matchban *@$orighost])} { |
Remember...Only when you are using the contents as a command do you ever want to use [bracket's]. I stated this in my post above if you read the end of the post.
Also worth nothing, the use of return would eliminate that nasty nest of if's your seem to be constructing. You simply return a value from the procedure and bail out.
| Code: | | if {isban *@$orighost} {} |
You made a mistake here, remember to put [bracket's] around commands. isban i'm guessing is a procedure/command. What I also assume is this evaluation is meant as a trap if it matches. Instead, why not simply: | Code: | | if {[isban *@$orighost]} { return 0 } |
Bail out, and return a condition of negative? This should help you on you way to fixing you script now  _________________ speechles' eggdrop tcl archive |
|
| Back to top |
|
 |
Scarpa_SD Voice
Joined: 25 May 2009 Posts: 3
|
Posted: Mon May 25, 2009 7:49 pm Post subject: |
|
|
Well that worked. Thanks so much speechles. I guess after I posted I started tinkering around with the script more instead of waiting for a response and messed something else up so when I did what you said it resulted in another error. After going back and reverting it to my original changes I removed the [] brackets from $status and it worked right. Plus now I know brackets only go around commands and not values.  |
|
| Back to top |
|
 |
|