cooper / juno

a seriously modern IRC daemon written from scratch in Perl. designed to be ridiculously extensible, painlessly reloadable, and excessively configurable
https://juno.mitchellcooper.me
ISC License
15 stars 4 forks source link

Multi-target commands are sloppy, dealt with inconsistently, and not configurable #53

Open cooper opened 8 years ago

cooper commented 8 years ago

Problem

There is no global limit for how many targets a multi-target command can have. Each command currently implements this differently: some have no limit, some have hardcoded limits, and some do not even support more than one target when they should.

Desired behavior

The target limit needs to be universal among all multi-target commands and configurable by limit:target. It should be reflected in RPL_ISUPPORT as MAXTARGETS (Currently, this is hardcoded to one, for compatibility with the commands which do not properly support multiple targets). Excess targets should be ignored.

Implementation

I think this should be implemented in the parameter parser. As it presently exists, commands with a single channel target use the channel parameter type. We could add channels which will look up a comma-separated list of channels and push an array reference of channel objects to the parameter list. If a channel does not exist, send out ERR_NOSUCHCHANNEL and skip it. If the target limit as specified by limit:target is reached, ignore the remainder of the list. The opt flag should be manually handled to indicate that an empty arrayref is permitted.

cooper commented 8 years ago

TARGMAX is a more flexible token. https://github.com/charybdis-ircd/charybdis/blob/7e1bb8ad0da6485b059f992dda3a37fb81c34094/ircd/supported.c#L277