bind join - "#canal *" topics
proc topics {nick uhost hand chan} {
if {[string equal -nocase $chan "$chan"]} {
set file [open pruebanick w]
set cuentame [chanlist $chan]
regsub -all "{" $cuentame "" cuentame
regsub -all "}" $cuentame "" cuentame
puts $file "$cuentame"
set op 0
set voice 0
set normal 0
putserv "notice $nick :Topic: [lrange [topic $chan] 0 end]"
putserv "notice $nick :Total de Usuarios: [llength [chanlist $chan]]"
putserv "notice $nick :Modos del canal: [lindex [getchanmode $chan] 0]"
foreach user [chanlist $chan] {
if {[isop $user $chan]} {
incr op
} elseif {[isvoice $user $chan]} {
incr voice
} else { incr normal }
}
putserv "notice $nick :Total de Op: $op - Total Voice: $voice - Total Normales: $normal"
}
close $file
}
bind part - "#canal *" partes
proc partes {nick uhost hand chan reason} {
if {$reason == ""} {
if {[string equal -nocase $chan "$chan"]} {
set file [open pruebanick w]
set cuentame [chanlist $chan]
regsub -all $nick $cuentame "" cuentame
set prueba [lsort -increasing -dictionary $cuentame]
puts $file "$prueba"
}
close $file
}
}
the problem is, in $file chanlist, if nick is [^__^] or |-XXX-|, when copying itself in the file it appears {[^__^]}, in the bind join this corrected with:
There is no need to be using regsub..
Your problem is with trying to use lists as strings...
for example... you use "lrange" to return a LIST, which will escape/protect special character elements...
To convert to a string you must use the [join] command....
ie. Topic: [join [lrange yer-normal-stuff-here]]
And when writing your variable "prueba" and "cuentame" to file, they are lists,
if you want to write it as a string, you must again, use [join]...
But now not like doing, that in part it clears to nick that it leaves the channel, of the list and sees the others nicks.
IE. In Join: [^__^] atest axe
In part: (if list leaves the channel [^__^]): atest axe