The problem I have is when search and find nicks that list that begin and end with braces.
Example:
The nicknames variable is stored the full list of nicks.
$nicknames = pedro juan {FoSFaTiTo} maria susan
When I fetch the nick {FoSFaTiTo} on that list, the code takes the argument WITHOUT braces (the nick contains those braces), for that reason can not find it in the list.
Code: Select all
## !list [nickname]
bind pub n !list list_out_of_fd
proc list_out_of_fd {nick uhost hand chan arg} {
  global nchan
  if {[string tolower $chan] != [string tolower $nchan]} {
   return
  }
  if {[llength $arg] == 0} {
##here nicknames variables take values of list##
   set nicknames [getinfo]
   if {$nicknames == ""} {
     puthelp "NOTICE $nick :No one is added in the database!"
   } else {
     puthelp "NOTICE $nick :Added in the database: $nicknames"
   }
  } elseif {[llength $arg] == 1} {
##here nicknames variables take values of list##
   set nicknames [getinfo]
#For debuggin purposes#
   putmsg $nchan "The list: $nicknames"
   set arg [lindex $arg 0]
#For debuggin purposes#  
 putmsg $nchan "Nick to search: $arg"
   if {[lsearch -exact [string tolower $nicknames] [string tolower $arg]] == -1} {
     puthelp "NOTICE $nick :$arg not found in the database!"
   } else {
     puthelp "NOTICE $nick :$arg  is in the database!"
   }
  } else {
   puthelp "NOTICE $nick :Usage: !list \[nickname\]"
  }
}Any idea how to solve this problem with nicks containing braces?<oper> !list {FoSFaTiTo}
<bot> The list: pedro juan {FoSFaTiTo} maria susan
<bot> Nick to search: FoSFaTiTo
<bot> FoSFaTiTo not found in the database!
EDIT:
Another thing I've found if I show the contents of the variable that contains the list, the list looks good by the channel.
Example:
Code: Select all
putmsg #canal "$nicknames"but if I do a foreach or use any other loop in the variable returns the nick me without the braces.pedro juan {FoSFaTiTo} maria susan
Code: Select all
foreach n $nicknames {
putmsg #canal "$n"
}It's so hard to fix this in Tcl?pedro
juan
FoSFaTiTo
maria
susan



