implement banforwards
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.
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
That makes sense.
We'd want to make sure that you can't forward in loops. Maybe you only get one redirect?
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?
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".)
Might it be cleaner to have one single all-purpose overflow channel? (Covering user limit, invite-only, registered-only, and all bans.)
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
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