eggdrop
eggdrop copied to clipboard
matchattr throws an error when testing -|-
A long time before, with eggdrop 1.6.21, it was possible to do matchattr $nick -|- $chan
and it returned 1 when user was unknow or haven't any flag in eggdrop.
Actually (since 1.8.x), it throws an error:
Tcl error: Unknown flag specified for matching
This also happen if you want to check if user has no global flag but a channel flag, or if user has global flag but no chan flag.
So, the only way to now check that is to do $handle != "*" && [chattr $handle $chan]=="-"
Old scripts must be modified, which could be a potential danger: some users don't update their eggdrops because scripts doesn't work anymore
Origin of the issue: MenzAgitat
When we redid the matchattr logic in 1.8.3, we did not accout for the '-' flag. Oops.
if (!minus.global && !minus.udef_global && !minus.chan &&
!minus.udef_chan && !minus.bot) {
nom = 1;
if (!plus.global && !plus.udef_global && !plus.chan &&
!plus.udef_chan && !plus.bot) {
Tcl_AppendResult(irp, "Unknown flag specified for matching", NULL);
return TCL_ERROR;
So, we need to either modify the struct in flags.h, or just generally allow it in code, and make down-code changes.
Referencing: #815
In my quizbot I had to apply a patch to check for "-" and "-|-":
if {$flags in [list "-" "-|-"] || [matchattr $hand $flags $chan]} {
return 1
}
return 0
So again I jumped the gun without re-acquainting myself with how this command works - previously discussed in #815. The '-' in this case means "not a flag", not "anything" as it does when used with binds, for instance. ie, +o means "has o", and -o means "not o", and "-" results in an error because there is no flag listed after the -.
Open for more discussion on this, but we have one symbol meaning two things, with both having historical precedent in this command