sigildocs

(sigil irc message)

(sigil irc message) - IRC Message Parsing

Parses and constructs IRC protocol messages.

IRC message format: [:prefix] command [params...] [:trailing]

Examples: :nick!user@host PRIVMSG #channel :Hello world PING :server.name :server 001 nick :Welcome to the IRC Network

Exports

irc-messageprocedure

Construct a irc-message struct.

irc-message?procedure

Test if a value is a irc-message struct.

Get the raw field of a irc-message struct.

Get the prefix field of a irc-message struct.

Get the nick field of a irc-message struct.

Get the user field of a irc-message struct.

Get the host field of a irc-message struct.

Get the command field of a irc-message struct.

Get the params field of a irc-message struct.

Get the trailing field of a irc-message struct.

Get the target of a message (first param, usually channel or nick).

For PRIVMSG, JOIN, PART, etc., this is the channel or user.

(irc-message-target msg)  ; => "#channel" or "nickname"

Get the text content of a message (alias for trailing).

(irc-message-text msg)  ; => "Hello world"

Parse a raw IRC message line into an irc-message record.

Returns an irc-message record, or #f if parsing fails.

(parse-irc-message ":nick!user@host PRIVMSG #chan :Hello")
; => #<irc-message nick: "nick" command: PRIVMSG ...>

Create an IRC command string from parts.

(make-irc-command "PRIVMSG" "#channel" "Hello world")
; => "PRIVMSG #channel :Hello world"

Convert an IRC command to a wire-format string (with CRLF).

(irc-command->string "PRIVMSG" "#channel" "Hello")
; => "PRIVMSG #channel :Hello\r\n"