generated from alex/base-template
feat: send multi-line announcements as IRCv3 draft/multiline batches #22
No reviewers
Labels
No labels
dependencies
No milestone
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
alex/irc-greeter-bot!22
Loading…
Reference in a new issue
No description provided.
Delete branch "pi/issue21-1786803087726"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #21
What
Implements the client side of the IRCv3
draft/multilinespec, and uses it for multi-line announcements — most visibly Forgejo release notes, which previously arrived as one separate IRC message per note line.How
@irc/client0.23.x (the latest) has no multiline plugin, so the extension is implemented in-tree following the repo's pure-logic/wiring split:src/multiline.ts(new, pure): parses themax-bytes/max-linesvalues from thedraft/multilineCAP advertisement, plans how a message is delivered (batch vs plain per-line fallback), splits over-long lines at word boundaries intodraft/multiline-concatcontinuations (multi-byte safe, trailing space kept per the spec's recommendation so halves re-join cleanly), enforces the server's limits with truncation + a…marker, and builds the wire commands.src/irc/multiline.ts(new, wiring): requests the cap during registration (the library'sbatchplugin already negotiates the requiredbatchdependency), captures the limits from the rawCAP LS/NEWexchange (incl. multi-line LS 302 continuation lines), and posts either one well-formed batch (BATCH +ref draft/multiline <target>/ taggedPRIVMSGs /BATCH -ref, sends chained so lines are never interleaved) or one plainPRIVMSGper non-blank line as fallback. State is keyed per client instance, so reconnects reset cleanly.src/irc/client.ts: attaches the multiline session on every (re)connection attempt.src/poller/forgejo-poller.ts/feed-poller.ts: post through the multiline-aware poster; on servers without the extension behavior is unchanged (one message per line).src/forgejo-activity.ts:postMessageLinesis gone — the whole multi-line notes text is now handed to the injectedpostin one piece, letting the production poster deliver it as a single batch.Per-line byte budgets use the spec's worst-case relay formula (
512 − 14 − 10 − nick/user/host), so servers can relay each line unchanged; limits are honored to avoidFAIL BATCHrejections.Known limitation (documented in AGENTS.md): blank lines inside a batch are dropped, because
@irc/client'ssend()cannot emit an empty trailingPRIVMSGparameter.Verification
New unit tests for both modules (
src/multiline_test.ts,src/irc/multiline_test.ts): cap parsing, planning, concat splits, byte-safety, truncation, wire shape, negotiation capture, fallbacks.End-to-end smoke test against a scripted IRC server through the real
@irc/client(not committed) confirmed the actual bytes on the wire:CAP REQ :batch draft/multiline, thenplus the
draft/multiline-concatform for over-long lines, all within the 512-byte frame limit.deno fmt --check,deno lint,deno check,deno test(305 passed), anddeno task fallowall green.