(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
batchcapability constant - Helpers to build BATCH start/end lines
- A
batch-contextrecord to track open batches when receiving - A reftag generator suitable for server use
Exports
batch-start-linevariableBuild 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"batch-end-linevariableBuild a BATCH -<reftag> closing line.
make-batch-reftagprocedureGenerate 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-context--typevariableGenerate 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-contextprocedureConstruct a batch-context struct.
batch-context?procedureTest if a value is a batch-context struct.
batch-context-open-tagsprocedureGet the open-tags field of a batch-context struct.
batch-context-typesprocedureGet the types field of a batch-context struct.
set-batch-context-open-tags!procedureSet the open-tags field of a batch-context struct.
set-batch-context-types!procedureSet the types field of a batch-context struct.
batch-open!procedureRecord a BATCH start. reftag is parsed by the consumer (the leading + is stripped). type is the batch type string.
batch-close!procedureRecord a BATCH end. reftag should be the bare reftag (no -).
batch-tag-ofprocedureIf a message has a batch tag, return its reftag string.
batch-type-ofprocedureLook up the batch type associated with a reftag in the context.
make-batch-contextvariable(No description)
batch-context-open?variable(No description)