| View previous topic :: View next topic |
| Author |
Message |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Tue Mar 15, 2022 12:44 pm Post subject: devoice on ban doesnt devoice {somenick} |
|
|
i have this odd issue with this code it seems to devoice on ban almost all nicks that match the banmask exept if the nick is a nick with {} like {somenick} {nick2} and such im puzzled as to why
| Code: |
bind mode - "* +b" devoice:onban
proc devoice:onban {nick uhost hand chan mc ban} {
if {![botisop $chan]} { return }
set ban [string map {"\\" "\\\\" "\[" "\\["} $ban]
if { [string first ":" $ban] != -1 } { set ban [lindex [split $ban ":"] 1] }
foreach n [chanlist $chan] {
if {![matchaddr $ban $n![getchanhost $n $chan]]} { continue }
if {![botisop $chan] || [isop $n $chan] || [ishalfop $n $chan] || [matchattr [nick2hand $n] fnmo|fnmo $chan] || [isbotnick $n]} { pushmode $chan -b $ban ; continue }
if {[isvoice $n $chan]} { pushmode $chan -v $n }
}
}
|
|
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Tue Mar 15, 2022 12:50 pm Post subject: |
|
|
nicks with {} [] seem to give lot of issues with many tcls scripts i noticed
i wonder if there is a general rule wich can be aplied to avoid all this |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Tue Mar 15, 2022 2:23 pm Post subject: |
|
|
It's been a while, so lets see how much I've actually forgotten...
As for brackets and braces in general, the most common issues I've come across over the years, is when scripters don't keep track of when they're operating on a string or a list. This is usually the case when I find search-and-replace snippets looking for those characters.
So only use list-operators (lindex, lrange, etc) on what you know to be a list.
The second most common one, is scripters sending unvalidated strings to expr/eval.
That said, I can't see any of those issues in the posted code.
You do have a search-and-replace snippet escaping backslash and opening-bracket in the banmask, which I belive is not needed (since banmasks use simple glob-style matching, not regular expressions). But unless the banmask includes those characters, that shouldn't be an issue.
Also curious why you split your banmask on ":"...
Think you could post some examples of banmasks and nicks that are not working properly? _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Wed Mar 16, 2022 4:10 am Post subject: |
|
|
thanks for your reply nml375
the reason for using :
| Quote: |
if { [string first ":" $ban] != -1 } { set ban [lindex [split $ban ":"] 1] }
|
is to get the banmask from like muteban or other extended bans like:
+b m:nick!ident@host |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Wed Mar 16, 2022 4:13 am Post subject: |
|
|
examples of nicks it doesnt get the banmask for to set a devoice is nicks like
[nick]
{nick} |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Wed Mar 16, 2022 4:49 am Post subject: |
|
|
i also noticed the built in ban-time setting doesnt unban banmasks like
{nick}!*@* as well |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Wed Mar 16, 2022 1:00 pm Post subject: |
|
|
| i welcome any help to deal with nicks that have {}[] in them as they seem to cause alot of problems with tcls |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Wed Mar 16, 2022 1:15 pm Post subject: |
|
|
I was hoping for some actual samples that failed to execute properly.
However, if the banmask would contain { or [, your character substitution would certainly interfere with mask matching...
matchaddr does not support backslash escaping, so adding those would insert characters in the mask that will not match user's nick!user@host...
So, remove this line for starters:
| Code: | | set ban [string map {"\\" "\\\\" "\[" "\\["} $ban] |
_________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Wed Mar 16, 2022 2:25 pm Post subject: |
|
|
i already tried both with and without that line both with same results
and i gave examples of banmasks let me give again
+b {nick}!*@*
+b [nick]!*@* |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Wed Mar 16, 2022 3:31 pm Post subject: |
|
|
Once again, I was not asking for examples, but actual samples that failed.
That said, I just fired up a 1.9.2 bot and did a few tests in console...
| Code: | .tcl set goodmask {[nick]!*@*}
Tcl: [nick]!*@*
.tcl set badmask [string map {"\\" "\\\\" "\[" "\\["} $goodmask]
Tcl: \[nick]!*@*
.tcl set uhost {[nick]!user@host}
Tcl: [nick]!user@host
.tcl matchaddr $goodmask $uhost
Tcl: 1
.tcl matchaddr $badmask $uhost
Tcl: 0 |
So, with the examples you posted, matching works just fine - as long as you don't start injecting random characters...
To ease with figuring out what is going wrong, we need actual samples. I would also recommend using putlog to print information such as what is the actual mask and nick!user@host used; or if the bot does not believe the user is voiced, etc... _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Thu Mar 17, 2022 2:58 am Post subject: |
|
|
| hm yes ive tested again and for some reason it seems fine now i cant grasp it ill monitor it some more and report back thanks again nml375 much apreciated |
|
| Back to top |
|
 |
|