Skip to content

ircv3: support draft/multiline#414

Draft
MaxLeiter wants to merge 1 commit into
max/04-09-labeled-responsefrom
max/05-01-multiline
Draft

ircv3: support draft/multiline#414
MaxLeiter wants to merge 1 commit into
max/04-09-labeled-responsefrom
max/05-01-multiline

Conversation

@MaxLeiter

@MaxLeiter MaxLeiter commented May 2, 2026

Copy link
Copy Markdown
Collaborator

Relies on #407

@ItsOnlyBinary

Copy link
Copy Markdown
Contributor

might be worth using https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder rather than using the isomorphic-textencoder dependency, it could be replaced in line splitter too.

maybe also possible to replace grapheme-splitter with https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter but im not sure how far back we need to support Safari (The new IE style annoyance of os linked browser versions)

Also think the multiline should be transparent auto handling in sendMessage.

Seeing all your branches im wondering if these pull's should be split into merge now, and merge for major version bump, as i would like to try and get a none breaking release out soon.

Negotiated when enable_multiline option is true. Inbound multiline
batches are concatenated and emitted as a single privmsg/notice event
with multiline: true set, using the prefix and tags from the BATCH
opener. Adds sayMultiline()/noticeMultiline() helpers that fall back
to per-line sends when the cap isn't enabled.
@MaxLeiter
MaxLeiter force-pushed the max/05-01-multiline branch from c9afdf6 to f096d38 Compare May 2, 2026 22:38
@MaxLeiter
MaxLeiter changed the base branch from master to max/04-09-labeled-response May 2, 2026 22:40
MaxLeiter added a commit to thelounge/thelounge that referenced this pull request Jul 20, 2026
Closes #5052

Multi-line input is currently sent as one PRIVMSG per line, so a paste
arrives as N unrelated messages. On networks that support
[draft/multiline](https://ircv3.net/specs/extensions/multiline) it can
be sent as a single BATCH and stays one message everywhere.

## Summary

Sending goes through `sayMultiline()` in `plugins/inputs/msg.ts` when
the network advertises limits we can respect (`multilineLimits()`); if
the batch is over max-bytes/max-lines the send falls back to individual
messages, and the local echo follows whichever path was actually taken
so the sender sees what everyone else got. `Client.input()` stops
splitting on newlines when the target network has the cap. Inbound
batches arrive from irc-framework already reassembled and are flagged
`multiline` on the `Msg`, which drives line-by-line rendering (`parse()`
joins lines with `<br>`), one entry per message in the text logs, and a
first-non-empty-line notification preview. `MULTILINE_*` standard
replies get readable text.

No pin bump: `master` already points at the irc-framework commit that
carries multiline (kiwiirc/irc-framework#414).

## Test Plan

- New unit tests for the send path (batch, fallback on max-bytes, no
limits advertised, blank lines), the text log format, `parse()`, and the
standard replies.
- Ran the server against a local IRCd advertising `draft/multiline` and
confirmed on the wire: a 3-line message goes out as one `BATCH …
draft/multiline` with three frames; with the cap advertised bare (no
limits) or with `max-bytes` too small it degrades to three plain
PRIVMSGs and the local echo degrades with it; a CRLF paste sends clean
frames and echoes without stray `\r`; an inbound batch from another user
renders as one message.
- Not verified: rendering was checked through unit tests rather than in
a browser.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants