egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Braces, brackets or backslash in the nicknames

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
juanamores
Master


Joined: 15 Mar 2015
Posts: 317

PostPosted: Sun Apr 26, 2015 2:16 am    Post subject: Braces, brackets or backslash in the nicknames Reply with quote

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 Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber