| View previous topic :: View next topic |
| Author |
Message |
[Lt]im Voice
Joined: 09 Mar 2006 Posts: 17 Location: Kaunas - Lithuania
|
Posted: Thu Aug 24, 2006 5:08 pm Post subject: Help: nick filter |
|
|
Hello, i have this proccess:
| Code: | proc pwf_addadmin {nick uhost hand channel rest} {
global pwf_pickupchan pwf_qauthnick pwf_qauthnick_timers pwf_qauth
set channel [string tolower $channel]
if { $channel == $pwf_pickupchan } {
set victime [lindex $rest 0]
if { [matchattr $hand H] } {
if [matchattr $hand m|m $channel] {
if [onchan $victime $channel] {
if {($pwf_qauth=="Q")||($pwf_qauth=="T")} {
set pwf_qauthnick_timers($victime) [utimer 20 "set pwf_qauthnick($victime) 0"]
trace variable pwf_qauthnick($victime) w pwf_addadmincheck
putserv "WHOIS $victime"
}
set victhand [nick2hand $victime]
if [string compare $victhand "*"] {
if [matchattr $victhand GL|GL $channel] {
putserv "NOTICE $nick :[pwf_txt right1]"
} else {
chattr $victhand +|GL $channel
putserv "NOTICE $nick :[pwf_txt right2] $victime"
putserv "NOTICE $victime :[pwf_txt right3] $channel [pwf_txt right4a]"
return 1
}
} else {
adduser $victime [maskhost [getchanhost $victime $channel]]
chattr [nick2hand $victime] +|GL $channel
putserv "NOTICE $nick :[pwf_txt right2] $victime"
putserv "NOTICE $victime :[pwf_txt right3] $channel [pwf_txt right4b]"
return 1
}
} else {
putserv "NOTICE $nick :[pwf_txt right5]"
}
} else {
putserv "NOTICE $nick :[pwf_txt right6]"
}
} else {
putserv "NOTICE $nick :[pwf_txt noauth]"
}
}
}
|
Can anyone help to edit this script, that eggdrop would not let to add new admin if he has "[" "]" in his nick? _________________ [Lt]im |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Thu Aug 24, 2006 5:35 pm Post subject: |
|
|
I'd use some regexp check for that..
One thing I did notice tho, in the beginning of your code, you are using lindex improperly. That is, you're using it on a string. To make matters even worse, it's a string supplied by a person..
what you'll have to do is something like this:
| Code: | | set victime [lindex [split $rest] 0] |
Instead of this:
| Code: | | set victime [lindex $rest 0] |
Most likely, that'll take care of atleast some issues with usernames containing [] aswell.. _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
[Lt]im Voice
Joined: 09 Mar 2006 Posts: 17 Location: Kaunas - Lithuania
|
Posted: Thu Aug 24, 2006 6:05 pm Post subject: |
|
|
Yeah,... but i really need "nick filter", that bot wount let to add new admin if he has "[ ]" in his nick, because after game, bot writes [admin] to pwf_stats like this - {[admin]}, and when gstat command is used, bot craches while trying to read {[admin]} from pwf_stats.  _________________ [Lt]im |
|
| Back to top |
|
 |
Alchera Revered One

Joined: 11 Aug 2003 Posts: 3344 Location: Ballarat Victoria, Australia
|
Posted: Thu Aug 24, 2006 8:29 pm Post subject: |
|
|
| [Lt]im wrote: | Yeah,... but i really need "nick filter", that bot wount let to add new admin if he has "[ ]" in his nick, because after game, bot writes [admin] to pwf_stats like this - {[admin]}, and when gstat command is used, bot craches while trying to read {[admin]} from pwf_stats.  |
You were given a "nick filter":
| Code: | | set victime [lindex [split $rest] 0] |
or..
| Code: | | set victime [lindex [split [string trim $rest]] 0] |
Edit your code accordingly and rehash the the bot. _________________ Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM |
|
| Back to top |
|
 |
|