juanamores Master
Joined: 15 Mar 2015 Posts: 317
|
Posted: Sun Apr 26, 2015 2:16 am Post subject: Braces, brackets or backslash in the nicknames |
|
|
I make a new post because the issue is to solve a portion of code that have been solved in other post.
In this TCL, for some reason the author decided to clean than nicks, the characters '{} [] \\'
For this purpose he used this process:
| Code: | proc charfilter {x {y ""} } {
for {set i 0} {$i < [string length $x]} {incr i} {
switch -- [string index $x $i] {
"\"" {append y "\\\""}
"\\" {append y "\\\\"}
"\[" {append y "\\\["}
"\]" {append y "\\\]"}
"\}" {append y "\\\}"}
"\{" {append y "\\\{"}
default {append y [string index $x $i]}
}
}
return $y
} |
When we add a nick with !addison command, the nick is added differently (if it contains braces, brackets or backslash).
Example.
| Quote: | <oper> !addison {fosforito}
<bot> Done. Successfully added \{fosforito\}. |
Then when I want to remove that nick, bot tells me that is not found in the database.
| Quote: | <oper> !delison {fosforito}
<bot> Nickname fosforito not found in the database! |
And if I try to remove the nick, the same way the bot added,the bot tells me that eliminated him, but in reality it does not eliminate the nick follows the archive database.
| Quote: | <oper> !delison \{fosforito\}
<bot> Nickname {fosforito} erased from the database! |
| Quote: | <oper>!list
<bot>Added in the database: \{fosforito\} |
I had a hard time understanding how this code, it may be because of my lack of experience.
Anyway, I could solve the other characters such as hyphens (-_-), but I could with whom I have discussed them.
| Code: | | regsub -all "$who" $nicknames "" nicknames |
Anyone is encouraged to analyze the code and see if you can find a solution?
EDIT: Solved! see this post. _________________ If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks  |
|