ircv3 / ircv3-specifications

IRCv3 specifications | Roadmap: https://git.io/IRCv3-Roadmap | Code of conduct: http://ircv3.net/conduct.html
http://ircv3.net
785 stars 79 forks source link

capability-negotiation: clarify CAP names cannot start with hyphen #519

Closed dgw closed 1 year ago

dgw commented 1 year ago

It's implied that capability names shouldn't start with a -, but not explicitly specified. Capability names "MUST" be treated as opaque identifiers. However, any possibility of a capability name that starts with - at all introduces ambiguity at the parsing step, and disallows simple solutions like if cap_name.startswith('-') and real_cap = cap_name.lstrip('-'). This patch proposes a formal prohibition on - as the first character of a capability name.

None of the CAP names listed in the IRCv3 registry have leading hyphens, nor have I ever seen a draft/ or vendor/ CAP name with one. The impact of this change on any live code should be nonexistent outside of (as a fellow developer put it) hypothetical "particularly antisocial" capability names in private use, not submitted to the registry.

Notes

Including myself, fellow developers working on upgrading our bot client's capability negotiation skills, and third parties we consulted along the way, at least half of the group (roughly 6-7 people) believed a leading hyphen is technically allowed by the current spec as written. I hope this revision removes all doubt that it was never intended to be permissible.