Commit3162b603Recorded27 Apr 2026Repositorysigil-irc

Re-export the new protocol modules from (sigil irc)

Message

The top-level (sigil irc) library now re-exports every binding from the protocol-layer modules: identity, tags, numerics, capability, cap-negotiation, sasl, sasl-scram, batch, chathistory, read-marker, monitor. The convenience client API in (sigil irc connection) is preserved unchanged.

Consumers building a server (e.g. enclave-server) typically import only the protocol-layer modules they need:

  (import (sigil irc message)
          (sigil irc cap-negotiation)
          (sigil irc capability)
          (sigil irc sasl)
          (sigil irc numerics))

Consumers writing a bot or alternate client can continue to import (sigil irc) for the full convenience surface.

Changed
 src/sigil/irc.sgl | 206 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------
 1 file changed, 180 insertions(+), 26 deletions(-)
Diff
src/sigil/irc.sglmodified
@@ -1,9 +1,29 @@
1
;;; (sigil irc) - IRC Client Library
+1
;;; (sigil irc) - IRC protocol library for the Sigil ecosystem
2
;;;
3
;;; A complete IRC client library with TLS support, SASL authentication,
4
;;; and cooperative non-blocking I/O for concurrent applications.
+3
;;; sigil-irc is the canonical IRC protocol library. It serves both
+4
;;; client and server flows for IRCv3, covering the modern Tier 1
+5
;;; ratified caps and the Tier 2 mobile-critical drafts (chathistory,
+6
;;; read-marker, MONITOR, SCRAM-SHA-256).
7
;;;
6
;;; ## Quick Start
+8
;;; ## Modules
+9
;;;
+10
;;; The library is decomposed into protocol-only modules that the
+11
;;; consumer assembles into a server, client, or bot:
+12
;;;
+13
;;; (sigil irc message) line parsing + IRCv3 message tags
+14
;;; (sigil irc tags) typed accessors for common tags
+15
;;; (sigil irc identity) nick@server-domain qualified identity
+16
;;; (sigil irc numerics) numeric reply constants
+17
;;; (sigil irc capability) cap descriptors + Tier 1+2 names
+18
;;; (sigil irc cap-negotiation) CAP state machines (both sides)
+19
;;; (sigil irc sasl) SASL state machines (PLAIN/EXTERNAL/SCRAM)
+20
;;; (sigil irc batch) BATCH command + tag helpers
+21
;;; (sigil irc chathistory) CHATHISTORY query parser/serializer
+22
;;; (sigil irc read-marker) draft/read-marker MARKREAD helpers
+23
;;; (sigil irc monitor) MONITOR command helpers
+24
;;; (sigil irc connection) high-level client convenience API
+25
;;;
+26
;;; ## Quick Start (client)
27
;;;
28
;;; ```scheme
29
;;; (import (sigil irc))
@@ -26,41 +46,49 @@
46
;;; (irc-run conn)
47
;;; ```
48
;;;
29
;;; ## With SASL Authentication
+49
;;; ## Server protocol (consumer drives I/O)
50
;;;
51
;;; ```scheme
32
;;; (define conn (make-irc-connection
33
;;; server: "irc.libera.chat"
34
;;; port: 6697
35
;;; nick: "mybot"
36
;;; tls: #t
37
;;; sasl-username: "mybot"
38
;;; sasl-password: "secret"))
39
;;; ```
+52
;;; (import (sigil irc message)
+53
;;; (sigil irc cap-negotiation)
+54
;;; (sigil irc capability)
+55
;;; (sigil irc sasl)
+56
;;; (sigil irc numerics))
57
;;;
41
;;; ## Integration with HTTP Server
+58
;;; (define cap-state
+59
;;; (make-cap-server-state
+60
;;; server-name: "enclave.example"
+61
;;; supported: (list (make-cap CAP-SASL value: "PLAIN,EXTERNAL")
+62
;;; (make-cap CAP-MESSAGE-TAGS)
+63
;;; (make-cap CAP-SERVER-TIME))))
64
;;;
43
;;; ```scheme
44
;;; (let loop ()
45
;;; (let* ((irc-sock (irc-connection-socket conn))
46
;;; (http-sock server-socket)
47
;;; (ready (socket-select (list irc-sock http-sock) '() 100)))
48
;;; (when (memq irc-sock (car ready))
49
;;; (irc-process-input conn))
50
;;; (when (memq http-sock (car ready))
51
;;; (handle-http-client))
52
;;; (loop)))
+65
;;; ;; In your per-connection fiber, on each incoming line:
+66
;;; (let* ((msg (parse-irc-message line))
+67
;;; (replies (cap-server-advance cap-state msg client-nick: nick)))
+68
;;; (for-each (lambda (r) (write-line conn r)) replies))
69
;;; ```
70
71
(define-library (sigil irc)
72
(import (sigil irc message)
+73
(sigil irc tags)
+74
(sigil irc identity)
+75
(sigil irc numerics)
+76
(sigil irc capability)
+77
(sigil irc cap-negotiation)
+78
(sigil irc sasl)
+79
(sigil irc sasl-scram)
+80
(sigil irc batch)
+81
(sigil irc chathistory)
+82
(sigil irc read-marker)
+83
(sigil irc monitor)
84
(sigil irc connection))
85
86
(export
60
;; From (sigil irc message)
+87
;; --- (sigil irc message) ---
88
irc-message
89
irc-message?
90
irc-message-raw
+91
irc-message-tags
92
irc-message-prefix
93
irc-message-nick
94
irc-message-user
@@ -70,11 +98,137 @@
98
irc-message-trailing
99
irc-message-target
100
irc-message-text
+101
irc-message-tag
+102
irc-message-has-tag?
103
parse-irc-message
+104
parse-irc-tags
+105
irc-tag-escape
+106
irc-tag-unescape
+107
irc-tags->string
108
make-irc-command
+109
make-irc-command/tags
110
irc-command->string
111
77
;; From (sigil irc connection)
+112
;; --- (sigil irc tags) ---
+113
TAG-TIME TAG-MSGID TAG-ACCOUNT TAG-BATCH TAG-LABEL TAG-REPLY TAG-TYPING
+114
msg-time msg-msgid msg-account msg-batch msg-label msg-reply msg-typing
+115
with-time with-msgid with-account with-batch with-label
+116
+117
;; --- (sigil irc identity) ---
+118
irc-identity
+119
irc-identity?
+120
make-irc-identity
+121
irc-identity-nick
+122
irc-identity-server
+123
irc-identity->canonical
+124
irc-identity->display
+125
irc-identity=?
+126
parse-irc-identity
+127
irc-identity-from-prefix
+128
irc-display-strip-server
+129
+130
;; --- (sigil irc numerics) ---
+131
irc-numeric-name
+132
irc-numeric->symbol
+133
RPL-WELCOME RPL-YOURHOST RPL-CREATED RPL-MYINFO RPL-ISUPPORT
+134
RPL-LUSERCLIENT RPL-LUSEROP RPL-LUSERUNKNOWN RPL-LUSERCHANNELS RPL-LUSERME
+135
RPL-AWAY RPL-WHOISUSER RPL-WHOISSERVER RPL-WHOISIDLE RPL-ENDOFWHO
+136
RPL-ENDOFWHOIS RPL-WHOISCHANNELS RPL-WHOISACCOUNT
+137
RPL-LIST RPL-LISTEND RPL-CHANNELMODEIS RPL-NOTOPIC RPL-TOPIC RPL-TOPICWHOTIME
+138
RPL-WHOREPLY RPL-NAMREPLY RPL-ENDOFNAMES
+139
RPL-MOTDSTART RPL-MOTD RPL-ENDOFMOTD
+140
ERR-NOSUCHNICK ERR-NOSUCHSERVER ERR-NOSUCHCHANNEL ERR-CANNOTSENDTOCHAN
+141
ERR-UNKNOWNCOMMAND ERR-NOMOTD ERR-NONICKNAMEGIVEN ERR-ERRONEUSNICKNAME
+142
ERR-NICKNAMEINUSE ERR-NICKCOLLISION ERR-NOTREGISTERED ERR-NEEDMOREPARAMS
+143
ERR-ALREADYREGISTERED ERR-PASSWDMISMATCH ERR-CHANOPRIVSNEEDED
+144
ERR-INVITEONLYCHAN ERR-BANNEDFROMCHAN ERR-BADCHANNELKEY
+145
RPL-LOGGEDIN RPL-LOGGEDOUT ERR-NICKLOCKED RPL-SASLSUCCESS
+146
ERR-SASLFAIL ERR-SASLTOOLONG ERR-SASLABORTED ERR-SASLALREADY RPL-SASLMECHS
+147
RPL-MONONLINE RPL-MONOFFLINE RPL-MONLIST RPL-ENDOFMONLIST ERR-MONLISTFULL
+148
CMD-FAIL CMD-WARN CMD-NOTE
+149
+150
;; --- (sigil irc capability) ---
+151
cap cap? make-cap cap-name cap-value
+152
cap->string string->cap parse-cap-list
+153
CAP-SASL CAP-MESSAGE-TAGS CAP-SERVER-TIME CAP-ACCOUNT-TAG CAP-ACCOUNT-NOTIFY
+154
CAP-EXTENDED-JOIN CAP-USERHOST-IN-NAMES CAP-MULTI-PREFIX CAP-AWAY-NOTIFY
+155
CAP-CHGHOST CAP-INVITE-NOTIFY CAP-SETNAME CAP-BATCH CAP-LABELED-RESPONSE
+156
CAP-ECHO-MESSAGE CAP-CAP-NOTIFY
+157
CAP-CHATHISTORY CAP-READ-MARKER CAP-MONITOR
+158
tier-1-caps tier-2-caps standard-caps
+159
+160
;; --- (sigil irc cap-negotiation) ---
+161
cap-client-state cap-client-state?
+162
make-cap-client-state
+163
cap-client-state-phase cap-client-state-server-caps
+164
cap-client-state-requested cap-client-state-acked cap-client-state-nakked
+165
cap-client-state-done?
+166
cap-client-start cap-client-advance
+167
cap-server-state cap-server-state?
+168
make-cap-server-state
+169
cap-server-state-phase cap-server-state-supported cap-server-state-enabled
+170
cap-server-state-cap-302
+171
cap-server-state-done?
+172
cap-server-advance
+173
+174
;; --- (sigil irc sasl) ---
+175
SASL-PLAIN SASL-EXTERNAL SASL-SCRAM-SHA-256
+176
encode-authenticate-payload decode-authenticate-chunks
+177
plain-payload parse-plain-payload
+178
sasl-client-state sasl-client-state? make-sasl-client-state
+179
sasl-client-state-mechanism sasl-client-state-phase
+180
sasl-client-state-result sasl-client-state-authcid
+181
sasl-client-start sasl-client-advance
+182
sasl-server-state sasl-server-state? make-sasl-server-state
+183
sasl-server-state-mechanism sasl-server-state-phase
+184
sasl-server-state-result sasl-server-state-authcid
+185
sasl-server-advance
+186
+187
;; --- (sigil irc sasl-scram) ---
+188
scram-client-driver scram-server-driver
+189
make-scram-client-state make-scram-server-state
+190
scram-credentials scram-credentials-salt-b64
+191
scram-credentials-iterations scram-credentials-stored-key
+192
scram-credentials-server-key
+193
derive-scram-credentials
+194
+195
;; --- (sigil irc batch) ---
+196
batch-start-line batch-end-line make-batch-reftag
+197
batch-context batch-context? make-batch-context
+198
batch-context-open-tags batch-context-types
+199
batch-context-open? batch-open! batch-close!
+200
batch-tag-of batch-type-of
+201
+202
;; --- (sigil irc chathistory) ---
+203
CHATHISTORY-BATCH-TYPE
+204
CHATHISTORY-BEFORE CHATHISTORY-AFTER CHATHISTORY-LATEST
+205
CHATHISTORY-AROUND CHATHISTORY-BETWEEN CHATHISTORY-TARGETS
+206
CHATHISTORY-FAIL-INVALID-PARAMS CHATHISTORY-FAIL-INVALID-TARGET
+207
CHATHISTORY-FAIL-MESSAGE-ERROR CHATHISTORY-FAIL-NEED-MORE-PARAMS
+208
chathistory-selector chathistory-selector?
+209
make-chathistory-selector
+210
chathistory-selector-kind chathistory-selector-value
+211
parse-chathistory-selector chathistory-selector->string
+212
chathistory-query chathistory-query?
+213
chathistory-query-subcommand chathistory-query-target
+214
chathistory-query-selector1 chathistory-query-selector2 chathistory-query-limit
+215
parse-chathistory-line chathistory-line
+216
+217
;; --- (sigil irc read-marker) ---
+218
READ-MARKER-CAP
+219
read-marker read-marker? make-read-marker
+220
read-marker-target read-marker-timestamp
+221
parse-markread-line markread-query-line markread-set-line
+222
+223
;; --- (sigil irc monitor) ---
+224
MONITOR-ADD MONITOR-REMOVE MONITOR-CLEAR MONITOR-LIST MONITOR-STATUS
+225
monitor-command monitor-command?
+226
monitor-command-subcommand monitor-command-targets
+227
parse-monitor-line monitor-line
+228
monitor-online-line monitor-offline-line
+229
monitor-list-line monitor-end-of-list-line monitor-list-full-line
+230
+231
;; --- (sigil irc connection) — convenience client API ---
232
irc-connection
233
make-irc-connection
234
irc-connection?