Skip to content
This repository has been archived by the owner on Jul 16, 2023. It is now read-only.

maskmatch matching wrong part of a mode change #3

Open
thegrumble opened this issue Oct 11, 2016 · 1 comment
Open

maskmatch matching wrong part of a mode change #3

thegrumble opened this issue Oct 11, 2016 · 1 comment

Comments

@thegrumble
Copy link

Example: If I set a channel -o+b test-nick *!*@you.are.banned, maskmatch will try to match test-nick part instead of *!*@you.are.banned:

Oct11[14:40:02] -- Nicks ####testchannel: [@test-nick]
Oct11[14:40:02] -- Channel ####testchannel: 1 nick (1 op, 0 voices, 0 normals)
Oct11[14:40:03] -- Mode ####testchannel [+ns]
Oct11[14:40:03] -- Channel created on Tue, 11 Oct 2016 14:40:02
Oct11[14:40:28] *maskmatch* No matches for [test-nick]
Oct11[14:40:28] -- Mode ####testchannel [-o+b test-nick *!*@you.are.banned] by test-nick
@Zarthus
Copy link
Owner

Zarthus commented Oct 11, 2016

The cause for this is relatively easy to find out:

Maskmatch does not look at ISUPPORT closely, meaning that neither CHANMODES type A (channel modes with arguments) nor PREFIX (channel modes with arguments not includes in CHANMODES). It only looks at the number of arguments and assumes the modes it knows about are the only ones with arguments (with is rather silly behaviour, in retrospect.)

The "correct" fix for this would include looking into ISUPPORT CHANMODES and PREFIX and filter out modes (with their associated argument) that are not being listened to.

Because this module only resolves around masks, it's possible to work around all that hard work by validating whether the argument is a hostmask, and discarding it if it is not (which might still lead to issues, but I can't think of any and if it does happen you could filter it out with the maskmatch.matching_modes setting.

In this case the sloppy fix is more appealing to me than the correct fix, I can't guarantee I'll ever work in the proper fix, but if I can reduce the number of false positives to a near zero with a relatively simple fix I'm all up for it.

@Zarthus Zarthus self-assigned this Oct 11, 2016
Zarthus added a commit to Zarthus/scripts that referenced this issue Oct 11, 2016
bug fix: works around a problem where modes with arguments are not being filtered out,
  and instead maskmatch starts matching against the wrong argument.
  This is a bit of a cheesy hack. Anyone is welcome to improve the logic on this.

relevant: Zarthus/weechat-scripts#3
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants