feat: implement IRC numerics batch 2 — connection registration, channel ops, user queries #59

Merged
sneak merged 4 commits from feature/irc-numerics-batch2 into main 2026-03-10 00:53:47 +01:00

4 Commits

Author SHA1 Message Date
clawbot
7bbd6de73a feat: add irc numerics package, deduplicate constants, fix dead code
All checks were successful
check / check (push) Successful in 1m5s
- Create internal/irc/ package with all IRC numeric reply codes (RFC 1459/2812)
  and command string constants as the single source of truth
- Replace all 69+ bare numeric string literals in api.go with named constants
  (e.g. irc.RplWelcome, irc.ErrNoSuchChannel)
- Add 'code' (int) and named 'command' (e.g. RPL_YOURHOST) fields to IRC
  message JSON replies via irc.Name() lookup in scanMessages
- Deduplicate command constants: remove local definitions from api.go,
  cmd/neoirc-cli/main.go, and cmd/neoirc-cli/api/client.go; all now import
  from internal/irc
- Fix dead code: remove handleListCmd/handleWhoCmd/handleWhoisCmd/
  sendWhoisNumerics that were unreachable due to dispatchCommand routing
  LIST/WHO/WHOIS to dispatchInfoCommand before dispatchQueryCommand.
  Route these commands to dispatchQueryCommand which has the improved
  implementations (e.g. ListAllChannelsWithCounts single-query vs N+1)
- Update enqueueNumeric and respondIRCError signatures from string to int
- Update test helper findNumeric to check the new 'code' JSON field

Closes #52
2026-03-09 15:49:29 -07:00
5efb4b6949 refactor: replace all bare command string literals with named constants
All checks were successful
check / check (push) Successful in 2m15s
Extract cmdLusers, cmdMode, cmdMotd, cmdNames, cmdNotice, cmdPing, cmdPong
constants in internal/handlers/api.go. Add corresponding constants in
cmd/neoirc-cli/main.go and cmd/neoirc-cli/api/client.go. Replace every bare
IRC command string literal in switch cases and command dispatch code with the
named constant. Zero bare command strings remain in any dispatch path.
2026-03-09 15:23:00 -07:00
a193831ed4 fix: extract repeated IRC command string literals to constants (goconst)
All checks were successful
check / check (push) Successful in 2m18s
2026-03-09 15:07:02 -07:00
clawbot
8d26df60db feat: implement IRC numerics batch 2 — connection registration, channel ops, user queries
Add comprehensive IRC numeric reply support:

Connection registration (001-005):
- 002 RPL_YOURHOST, 003 RPL_CREATED, 004 RPL_MYINFO, 005 RPL_ISUPPORT
- All sent automatically during session creation after RPL_WELCOME

Server statistics (251-255):
- RPL_LUSERCLIENT, RPL_LUSEROP, RPL_LUSERCHANNELS, RPL_LUSERME
- Sent during connection registration and via LUSERS command

Channel operations:
- MODE command: query channel modes (324 RPL_CHANNELMODEIS, 329 RPL_CREATIONTIME)
- MODE command: query user modes (221 RPL_UMODEIS)
- NAMES command: query channel member list (353/366)
- LIST command: list all channels (322 RPL_LIST, 323 end of list)

User queries:
- WHOIS command: 311/312/318/319 numerics
- WHO command: 352 RPL_WHOREPLY, 315 RPL_ENDOFWHO

Database additions:
- GetChannelCount, ListAllChannelsWithCounts
- GetChannelCreatedAt, GetSessionCreatedAt

Also adds StartTime to Globals for RPL_CREATED and updates README
with comprehensive documentation of all new commands and numerics.

closes #52
2026-03-09 15:04:10 -07:00