Skip to content

Instantly share code, notes, and snippets.

@jesopo
Last active September 5, 2019 16:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jesopo/092866e52b40cda6f6205263d04dbcf9 to your computer and use it in GitHub Desktop.
Save jesopo/092866e52b40cda6f6205263d04dbcf9 to your computer and use it in GitHub Desktop.
bitbot.dev/multiline IRCv3 CAP outline

bitbot.dev/multiline

rationale

Simple: people want to either paste multi-line things (e.g. code) or say things that either cover multiple lines or extend past the ~512 byte cap. this spec is designed to solve all 3.

Technicals

CAP

bitbot.dev/multiline

Indicates the client can handle (and send) multiline BATCHes. REQing this CAP implicitly enabled BATCHes but only of the type bitbot.dev/multiline

BATCH

bitbot.dev/mulitline

This spec (somewhat unfortunately) has to introduce the concept of client-to-server BATCHes. The same rules and regulations for server-to-client BATCHes applies.

Message tag

bitbot.dev/multiline-concat

This is used to concatenate a line to the previous line instead of making it a new line entirely. Used to bypass ~512 byte cap. Can only be used within the bitbot.dev/multiline BATCH.

Degradation

Degradation to non-compat clients is simple. Strip the BATCH and strip the c2c message tag. Leave it up to the client sending the multiline message to break long lines gracefully (on word boundaries etc) so that it still looks reasonable when a bitbot.dev/multiline-concat line hits a non-compat client - much like e.g. irssi does now; if you send a really long line, irssi will split it in to multiple lines and try to split the lines up at places that make sense to whoever is receiving it instead of cutting a word in half.

Server-side considerations

This will probably require servers to relax some flood-protection rules in the event of this BATCH being received - counting them all as one message or so. Servers might also want to reject large BATCHes in channels but permit them in private.

Examples

C2S batch

c -> s: BATCH +123 bitbot.dev/multiline #channel
c -> s: @batch=123 PRIVMSG #channel hello
c -> s: @batch=123 privmsg #channel :how is
c -> s: @batch=123;bitbot.dev/multiline-concat PRIVMSG #channel : everyone?
c -> s: BATCH -123

S2C batch

s -> c: :jesopo!jess@lolnerd.net BATCH +123 bitbot.dev/multiline #channel
s -> c: @batch=123 :jesopo!jess@lolnerd.net PRIVMSG #channel hello
s -> c: @batch=123 :jesopo!jess@lolnerd.net PRIVMSG #channel :how is
s -> c: @batch=123;bitbot.dev/multiline-concat :jesopo!jess@lolnerd.net PRIVMSG #channel : everyone?
s -> c: BATCH -123

Becomes

hello
how is everyone?

Degraded

Will hit non-compat clients as:

:n!u@h PRIVMSG #channel hello
:n!u@h PRIVMSG #channel :how is
:n!u@h PRIVMSG #channel : everyone?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment