| View previous topic :: View next topic |
| Author |
Message |
Branden Halfop
Joined: 04 Aug 2007 Posts: 61
|
Posted: Sun Sep 28, 2008 12:02 pm Post subject: Extra Characters on StrictHost Script [Help] |
|
|
The script below adds an extra character at the beginning of the ident!
| Code: |
proc stricthost {host chan} {
set strict 0
if {[string index $host 0] == "!"} {
set host [string range $host 1 end]
set strict 1
}
if {![string match "*@*" $host]} {
set addhost "$host[getchanhost $host $chan]"
if {$strict == 0} {
set addhost [maskhost "*$addhost"]
} else {
if {[string index $addhost 0] == "~"} {set addhost "*[string range $addhost 1 end]"}
set addhost "*$addhost"
}
set host $addhost
}
return $host
}
proc Ban { nick host hand chan text } {
set Who [lindex [split $text] 0]
set Why [lrange $text 2 100]
set thehost [stricthost $Who $chan]
putquick "MODE $chan +b $thehost"
putquick "KICK $chan $Who $Why"
}
|
The REAL host is: *!*t0xs7s@*.east.verizon.net
And, what the bot is banning is: *!*st0xs7s@*.east.verizon.net[/code] |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sun Sep 28, 2008 1:48 pm Post subject: |
|
|
There are a few things in your code that makes little sense to me:
| Code: | if {[string index $addhost 0] == "~"} {set addhost "*[string range $addhost 1 end]"}
set addhost "*$addhost" |
Why have the conditional if you're only going to overwrite the addhost variable anyway.. I doubt this is the cause for the "odd behaviour".
| Code: | | set Why [lrange $text 2 100] |
$text is not a list, so don't use list operations on it. Split it first like you did on the row before...
| Code: | | set addhost "$host[getchanhost $host $chan]" |
Shouldn't this be "$host![getchanhost $host $chan]", or simply [getchanhost $host $chan]?
At the same time, neither way makes sense with the "strict" operation further on where you prefix this with a "*", essentially making the mask "*nickuser@host" or "*nick!user@host". Seems you want $addhost to hold nick!user@host if $strict is 0, and user@host otherwize.. I'd suggest you look into this part of the code, as it may very well be the culprit of your problems... _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
Branden Halfop
Joined: 04 Aug 2007 Posts: 61
|
Posted: Sun Sep 28, 2008 3:21 pm Post subject: |
|
|
To be honest, I didn't code this...
Could you please help me code it correctly? |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Tue Sep 30, 2008 10:05 am Post subject: |
|
|
Ahh, my bad. Thought I was checking "Scripting Help" rather than "Script Request"
Anyway, an attempt at rewriting the code in a somewhat proper way.. I have not made any major efforts to solve some ambiguity in the code, such as wether to kick when the target is a banmask rather than a nick, or whether to test if the nick is actually present in the channel.. I cannot guarantee this will produce exactly the same behaviour as the former code, but based on my understanding of the script, the edited version should behave somewhat similar with "logical" arguments.
| Code: | proc stricthost {target chan} {
if {![string match "*@*" $target]} {
set host "[getchanhost $target $chan]"
if {[string index $target 0] == "!"} {
return [maskhost "[string range $target 1 end]!$host"]
}
if {[string index $host 0] == "~"} {
return "*!*[string range $host 1 end]"
}
return "*!*$host"
}
return $target
}
proc Ban { nick host hand chan text } {
set t_list [split $text]
pushmode $chan +b [stricthost [lindex $t_list 0]]
putkick $chan [lindex $t_list 0] [join [lrange $t_list 1 end]]
}
|
_________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
Branden Halfop
Joined: 04 Aug 2007 Posts: 61
|
Posted: Sat Oct 11, 2008 2:52 pm Post subject: |
|
|
Sorry for my delayed response, the script indeed does work.
But.
It is banning; *!*IDENT@Vhost
Example: *!*Branden@NetAdmin.CyberByteCafe.Co.CC
I want it to ban; *!*@*.rest.of.vhost
Example: *!*@*.CyberByteCafe.Co.CC |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Wed Oct 22, 2008 10:16 am Post subject: |
|
|
No worries, been out of town for a while myself...
What you ask for, pretty much mimics the behaviour of the maskhost function. Only added/kept the nick => hostmask feature..
Give it a try..
| Code: | proc stricthost {target chan} {
if {![string match "*@*" $target]} {
return [maskhost "[string trimleft $target "!"]![getchanhost $target $chan]"]
}
return [maskhost $target]
}
proc Ban { nick host hand chan text } {
set t_list [split $text]
pushmode $chan +b [stricthost [lindex $t_list 0]]
putkick $chan [lindex $t_list 0] [join [lrange $t_list 1 end]]
} |
_________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
|