sigildocs

(sigil irc batch)

(sigil irc batch) - IRCv3 batch tag and BATCH command helpers

The IRCv3 batch capability lets a server group related messages into a single batch identified by a reference tag. Clients that negotiate batch see:

:server BATCH +<reftag> <batch-type> [params...]
@batch=<reftag> :sender PRIVMSG #chan :line 1
@batch=<reftag> :sender PRIVMSG #chan :line 2
:server BATCH -<reftag>

Reftags are server-chosen short strings unique within an open-batch window on a connection. Common batch types include chathistory, netsplit, netjoin, multiline, and the read-marker batch defined by the chathistory spec.

This module provides:

  • The batch capability constant
  • Helpers to build BATCH start/end lines
  • A batch-context record to track open batches when receiving
  • A reftag generator suitable for server use

Exports

Build a BATCH +<reftag> <type> [params...] opening line. prefix is the optional source (typically the server name).

(batch-start-line "abc123" "chathistory" params: '("#channel"))
; => "BATCH +abc123 chathistory #channel\r\n"

Build a BATCH -<reftag> closing line.

Generate a fresh batch reference tag. The tag is opaque to clients, must be unique among currently-open batches on the connection, and is conventionally short (10-16 chars). We use 8 random bytes base64-encoded with the trailing = stripped, yielding 11 URL-safe-ish chars.

Generate a fresh batch reference tag. The tag is opaque to clients, must be unique among currently-open batches on the connection, and is conventionally short (10-16 chars). We use 8 random bytes base64-encoded with the trailing = stripped, yielding 11 URL-safe-ish chars.

batch-contextprocedure

Construct a batch-context struct.

Test if a value is a batch-context struct.

Get the open-tags field of a batch-context struct.

Get the types field of a batch-context struct.

Set the open-tags field of a batch-context struct.

Set the types field of a batch-context struct.

batch-open!procedure

Record a BATCH start. reftag is parsed by the consumer (the leading + is stripped). type is the batch type string.

batch-close!procedure

Record a BATCH end. reftag should be the bare reftag (no -).

batch-tag-ofprocedure

If a message has a batch tag, return its reftag string.

batch-type-ofprocedure

Look up the batch type associated with a reftag in the context.

(No description)

(No description)