| View previous topic :: View next topic |
| Author |
Message |
Reynaldo Halfop
Joined: 11 May 2005 Posts: 54
|
Posted: Fri Jun 22, 2007 5:33 am Post subject: unmatched open brace in list |
|
|
any idea how to kick the nick with special character like {,},[,],\
| Code: |
putserv "KICK $chan $nick :$reason"
|
will return error: Tcl error procname: unmatched open brace in list.
Many thanks before.  |
|
| Back to top |
|
 |
Alchera Revered One

Joined: 11 Aug 2003 Posts: 3344 Location: Ballarat Victoria, Australia
|
|
| Back to top |
|
 |
Reynaldo Halfop
Joined: 11 May 2005 Posts: 54
|
Posted: Fri Jun 22, 2007 8:36 pm Post subject: |
|
|
| Code: |
proc filt {data} {
regsub -all -- \\\\ $data \\\\\\\\ data
regsub -all -- \\\[ $data \\\\\[ data
regsub -all -- \\\] $data \\\\\] data
regsub -all -- \\\} $data \\\\\} data
regsub -all -- \\\{ $data \\\\\{ data
regsub -all -- \\\" $data \\\\\" data
return $data
}
|
Thanks bro.
Here's another one:
Can we replace "putquick" command with "pushmode" command ?
because i worry if it will make it slower. |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Fri Jun 22, 2007 8:49 pm Post subject: |
|
|
pushmode is for modes and not for kicks. Your problem is with using lists and strings, it's not recommended to solve it using regexp filtering. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
Reynaldo Halfop
Joined: 11 May 2005 Posts: 54
|
Posted: Fri Jun 22, 2007 11:23 pm Post subject: |
|
|
| Code: |
bind join - * do_jn_msg
proc do_jn_msg {nick uhost hand chan} {
global botnick jn_msg_done
set nick [filt $nick]
if {$nick == "X" || $nick == $botnick} {
return 0
}
if {[info exists jn_msg_done($nick:$chan)]} {
return 0
}
set jn_msg_done($nick:$chan) 1
timer 3 "unset jn_msg_done($nick:$chan)"
puthelp "NOTICE $nick :Welcome to $chan"
return 0
}
|
Tcl error [do_jn_msg]: unmatched open brace in list
$nick join with special character will return that error. |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Sat Jun 23, 2007 5:00 am Post subject: |
|
|
That's because you're passing a string instead of a list to [timer]. Replace:
| Code: | | timer 3 "unset jn_msg_done($nick:$chan)" |
with
| Code: | | timer 3 [list unset jn_msg_done($nick:$chan)] |
And remove the [filt $nick] line it's not necessary. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
Reynaldo Halfop
Joined: 11 May 2005 Posts: 54
|
Posted: Sat Jun 23, 2007 5:51 am Post subject: |
|
|
| Code: |
bind join - * do_jn_msg
proc do_jn_msg {nick uhost hand chan} {
global botnick jn_msg_done
if {$nick == "X" || $nick == $botnick} {
return 0
}
if {[info exists jn_msg_done($nick:$chan)]} {
return 0
}
set jn_msg_done($nick:$chan) 1
timer 3 [list unset jn_msg_done($nick:$chan)]
puthelp "NOTICE $nick :Welcome to $chan"
return 0
}
|
Tcl error [do_jn_msg]: unmatched open brace in list
still error, it happen when user with special character joined. like {user or }user or \user. |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Sat Jun 23, 2007 5:08 pm Post subject: |
|
|
The code I gave you must not give such an error. Did you rehash after loading it? Also, a full errorInfo (.set errorInfo) is much more helpful. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
Reynaldo Halfop
Joined: 11 May 2005 Posts: 54
|
Posted: Sat Jun 23, 2007 10:13 pm Post subject: |
|
|
| Code: |
foreach x [string tolower $badwords] {
if {[string match "*$x*" [string tolower $nick]]} {
set bannick($nick) "$nick!*@*"
putserv "KICK $chan $nick :Badword detected"
}
|
added that lines, will return the error. when user with special character joining channel. |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Sun Jun 24, 2007 8:10 am Post subject: |
|
|
[string tolower $badwords] is not a list, what is $badwords? _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
Reynaldo Halfop
Joined: 11 May 2005 Posts: 54
|
Posted: Mon Jun 25, 2007 8:43 pm Post subject: |
|
|
| badwords - [censored] fukker asshole |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
|
| Back to top |
|
 |
Reynaldo Halfop
Joined: 11 May 2005 Posts: 54
|
Posted: Tue Jun 26, 2007 12:56 am Post subject: |
|
|
| Yes, it's alist of badwords for nick and swearing text |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Tue Jun 26, 2007 6:35 am Post subject: |
|
|
| Code: | foreach x $badwords {
if {[string match -nocase *$x* $nick]} {
set bannick($nick) "$nick!*@*"
putserv "KICK $chan $nick :Badword detected"
break
}
} |
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
Reynaldo Halfop
Joined: 11 May 2005 Posts: 54
|
Posted: Tue Jun 26, 2007 10:16 pm Post subject: |
|
|
this's proc for ban/kick badnick
| Code: |
proc badnick_chk {nick uhost hand chan} {
global bannick notc botnick badwords
foreach x $badwords {
if {[string match -nocase *$x* $nick]} {
set bannick($nick) "$nick!*@*"
putsrv "KICK $chan $nick :Badnick match from [string toupper $x]"
return 1
}
}
return 0
}
|
i'm using channel flag: here's the code if badnick is enabled on specific channel
| Code: |
if {[matchattr $cflag B]} { badnick_chk $nick $uhost $hand $chan }
|
then return tcl error: unmatched open brace in list
if $nick with special character joined
* {asshole (~user@host) has joined #
i think with that code will return like this:
if {[matchattr $cflag B]} { badnick_chk {asshole $uhost $hand $chan } |
|
| Back to top |
|
 |
|