(sigil irc connection)
(sigil irc connection) - IRC Connection Management
Handles IRC connections with TLS support, message buffering, SASL authentication, and event dispatching.
Exports
irc-connectionprocedureConstruct a irc-connection struct.
irc-connection?procedureTest if a value is a irc-connection struct.
irc-connection-serverprocedureGet the server field of a irc-connection struct.
irc-connection-portprocedureGet the port field of a irc-connection struct.
irc-connection-nickprocedureGet the nick field of a irc-connection struct.
irc-connection-userprocedureGet the user field of a irc-connection struct.
irc-connection-realnameprocedureGet the realname field of a irc-connection struct.
irc-connection-tls?procedureGet the tls? field of a irc-connection struct.
irc-connection-sasl-usernameprocedureGet the sasl-username field of a irc-connection struct.
irc-connection-sasl-passwordprocedureGet the sasl-password field of a irc-connection struct.
irc-connection-stateprocedureGet the state field of a irc-connection struct.
irc-connection-socketprocedureGet the socket field of a irc-connection struct.
irc-connection-bufferprocedureGet the buffer field of a irc-connection struct.
irc-connection-current-nickprocedureGet the current-nick field of a irc-connection struct.
irc-connection-channelsprocedureGet the channels field of a irc-connection struct.
irc-connection-message-handlersprocedureGet the message-handlers field of a irc-connection struct.
irc-connection-command-handlersprocedureGet the command-handlers field of a irc-connection struct.
set-irc-connection-state!procedureSet the state field of a irc-connection struct.
set-irc-connection-socket!procedureSet the socket field of a irc-connection struct.
set-irc-connection-buffer!procedureSet the buffer field of a irc-connection struct.
set-irc-connection-current-nick!procedureSet the current-nick field of a irc-connection struct.
set-irc-connection-channels!procedureSet the channels field of a irc-connection struct.
set-irc-connection-message-handlers!procedureSet the message-handlers field of a irc-connection struct.
set-irc-connection-command-handlers!procedureSet the command-handlers field of a irc-connection struct.
make-irc-connectionvariableCreate a new IRC connection (does not connect yet).
Options: server: - IRC server hostname (required) port: - Port number (default: 6667, or 6697 for TLS) nick: - Nickname (required) user: - Username (default: same as nick) realname: - Real name (default: "") tls: - Use TLS (default: #f) sasl-username: - SASL username (optional) sasl-password: - SASL password (optional)
(make-irc-connection
server: "irc.libera.chat"
port: 6697
nick: "mybot"
tls: #t)irc-connected?procedureCheck if connection is in connected state.
irc-connectprocedureConnect to the IRC server.
Establishes the connection, performs TLS handshake if enabled, and begins IRC registration (NICK/USER or CAP/SASL).
Returns #t on success, #f on failure.
irc-disconnectprocedureDisconnect from the IRC server.
Optionally sends a QUIT message before closing.
irc-on-messageprocedureRegister a handler for all incoming messages.
The handler receives an irc-message record.
(irc-on-message conn
(lambda (msg)
(display (irc-message-command msg))
(newline)))irc-onprocedureRegister a handler for a specific IRC command.
(irc-on conn 'PRIVMSG
(lambda (msg)
(display (irc-message-text msg))))irc-send-rawprocedureSend a raw IRC command (must include trailing CRLF).
irc-process-inputprocedureProcess available input from the IRC connection.
Reads data from the socket, parses complete lines, and dispatches messages to handlers. Call this when socket-select indicates the connection is readable.
Returns #t if connection is still alive, #f if disconnected.
irc-privmsgprocedureSend a PRIVMSG to a channel or user.
irc-noticeprocedureSend a NOTICE to a channel or user.
irc-joinprocedureJoin a channel.
irc-partprocedureLeave a channel.
irc-quitprocedureSend QUIT and disconnect.
irc-nickprocedureChange nickname.
irc-modeprocedureSet mode.
irc-nickserv-identifyprocedureIdentify with NickServ.
Can be called with just password (uses current nick) or with nick and password (for grouped nicks).
irc-tickprocedureProcess one tick of the IRC connection (non-blocking).
Checks if data is available and processes it. Returns #t if connection is alive, #f if disconnected.
irc-runprocedureRun the IRC connection event loop.
Processes messages until disconnected. When running inside a channel-run context, cooperates with other tasks via await-readable. Otherwise blocks in a traditional event loop.