Repository navigation
Add IRCv3 CAP negotiation skeleton with a static capability registry - #269
Open
devin-ai-integration[bot] wants to merge 6 commits into
Open
devin-ai-integration[bot] wants to merge 6 commits into
devin-ai-integration[bot] wants to merge 6 commits into
Conversation
Implements CAP LS [302], LIST, REQ and END. Capabilities are listed in clientcaps[] in caps.c and checked with HasCap(). Registration is held from the first CAP LS/REQ until CAP END. REQ is applied atomically (ACK or NAK for the whole list, -cap disables). cap-notify is the only built-in capability and is enabled implicitly by CAP LS 302. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
…ter_user in h.h Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds IRCv3 client capability negotiation (
CAP, version 302) as the base for adding individual caps in later small PRs. Caps are registered statically in core. Bahamut's hook modules can't add commands or change the registration handshake, so caps can't live in modules for now. This PR is independent of #268, which keeps server-sideCAPABand treats the existing server caps as the baseline. Client caps (clientcaps[]/caps) and server caps (servcapabs[]/capabilities) are separate registries.Adding a cap later looks like this:
Negotiation (
src/caps.c,m_cap):CAP LS [302]: lists the caps. 302 clients getname=valuepairs and multi-line replies with a*continuation marker. Lines are split atCAP_LINELEN.CAP LIST: shows the caps enabled for this client, without values even for 302 clients (the spec allows values only in LS/NEW).CAP REQ :a -b: applied all-or-nothing. A copy ofsptr->capsis edited and stored only on ACK; a NAK changes nothing. A-prefix disables a cap.461.CAP_LINELENcan't be echoed in one ACK. It is NAKed without any change, and the echoed list is cut at the last whole token.CAP END: resumes registration.410 ERR_INVALIDCAPCMD. Missing subcommand →461.CAP LS/CAP REQfrom an unregistered client setsFLAGS_CAPNEGO, viaSetCapNegotiating(). While it is set,m_nick/m_userdon't callregister_user();CAP ENDclears the flag and calls it once both NICK and USER have arrived. Those are the only localregister_user()callers. Clients that never send CAP register as before, and a client that never sends END is still dropped byCONNECTTIMEOUT.cap-notifyis the only built-in cap.CAP LS 302turns it on implicitly, and after that it can't be disabled (CAPF_STICKY_302).New local-only
aClientfields:uint64_t caps(64 caps) andint cap_version. They come aftercount, so they aren't allocated for remote clients, andHasCap()checksMyConnectfirst.FLAGS_CAPNEGOtakes the free0x010000bit inflags.sizeof(aClient)goes from 1816 to 1832 on x86_64, andCLIENT_REMOTE_SIZEis unchanged. Theregister_user()prototype moved toinclude/h.h.CAP NEW/CAP DELaren't sent yet, because caps can't change at runtime.Testing
tools/testnet(#270) on this branch: all 17 tests pass (11 CAP, 6 link). Build warning count is unchanged (15).Link to Devin session: https://app.devin.ai/sessions/9c171b7fd3d341178646e3cce156ddd7
Open in Devin Desktop: https://app.devin.ai/desktop/session/9c171b7fd3d341178646e3cce156ddd7?variant=devin
Requested by: @eaescob