Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement banforwards #1238

Open
jesopo opened this issue Aug 18, 2020 · 7 comments
Open

implement banforwards #1238

jesopo opened this issue Aug 18, 2020 · 7 comments

Comments

@jesopo
Copy link
Contributor

jesopo commented Aug 18, 2020

an example of how this concept works, from charybdis:
/mode #chan +b *!*@badhost$##fix-your-connection

will forward anyone matching the mask to the given channel - mask and channel being delimited by $.

i'd be very happy if the format could remain the same, but it wouldn't be the end of the world if it can't.

@jesopo
Copy link
Contributor Author

jesopo commented Aug 18, 2020

my suggestion would be that we store the forward channel in MaskInfo objects and then change
https://github.com/oragono/oragono/blob/55b21fa86c462a283f296753cd3ee9288177ad5f/irc/client_lookup_set.go#L423
to somehow figure out which mask you match, rather than just "you match somewhere in the regex". we can then get the MaskInfo for the mask and pass that up to
https://github.com/oragono/oragono/blob/c55b25d6a181ab76d481d73012954a65fa532a27/irc/channel.go#L703
which can then pass up instructions to
https://github.com/oragono/oragono/blob/c55b25d6a181ab76d481d73012954a65fa532a27/irc/handlers.go#L1175-L1178
to issue a redirect instead of an ERR

@slingamn
Copy link
Member

That makes sense.

We'd want to make sure that you can't forward in loops. Maybe you only get one redirect?

@jesopo
Copy link
Contributor Author

jesopo commented Aug 19, 2020

sounds good.

perhaps we could change the big regex to be "(asd!*@*)|(dsa!*@*)|(sda!*@*)" etc and then we figure out the index of which group we matched and use that to figure out which mask we matched? i think regexp.FindStringSubmatch could do this?

@slingamn
Copy link
Member

I think it's not necessarily going to be straightforward to determine which clause was matched, just from the matched substring. (Although if you can see a way to do it, that would certainly be interesting.)

When I benchmarked irc/utils/glob.go I found that matching against one big or-expression wasn't that much faster than just trying to match every individual ban regex in sequence. We could just do that instead.

re. syntax, note that $ is currently an allowed character in Oragono nicknames. (But # isn't allowed in nicks, usernames, or hostnames; if I understand the Charybdis syntax correctly, we could treat $# as the delimiter and then "put the # back".)

@slingamn
Copy link
Member

Might it be cleaner to have one single all-purpose overflow channel? (Covering user limit, invite-only, registered-only, and all bans.)

@jesopo
Copy link
Contributor Author

jesopo commented Aug 20, 2020

yes that's usually cmode +f, banforwards are very often utilised for specific actions against specific people, such as if they are rapidly reconnecting, you forward them to ##fix-your-connection

@jesopo
Copy link
Contributor Author

jesopo commented Aug 20, 2020

as for $ being valid in nicknames, as long as it's not valid in hostnames, we can use $ as the delimiter but only when it's on the righthand side of the @ in a banmask

@slingamn slingamn added this to the v2.5 milestone Oct 22, 2020
@slingamn slingamn modified the milestones: v2.5, v2.6 Dec 10, 2020
@slingamn slingamn modified the milestones: v2.6, v2.7 Apr 7, 2021
@slingamn slingamn modified the milestones: v2.7, v2.8 May 30, 2021
@slingamn slingamn modified the milestones: v2.8, v2.9 Aug 26, 2021
@slingamn slingamn modified the milestones: v2.9, v2.10 Dec 20, 2021
@slingamn slingamn removed this from the v2.10 milestone Apr 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants