(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-messageprocedureConstruct a irc-message struct.
irc-message?procedureTest if a value is a irc-message struct.
irc-message-rawprocedureGet the raw field of a irc-message struct.
irc-message-prefixprocedureGet the prefix field of a irc-message struct.
irc-message-nickprocedureGet the nick field of a irc-message struct.
irc-message-userprocedureGet the user field of a irc-message struct.
irc-message-hostprocedureGet the host field of a irc-message struct.
irc-message-commandprocedureGet the command field of a irc-message struct.
irc-message-paramsprocedureGet the params field of a irc-message struct.
irc-message-trailingprocedureGet the trailing field of a irc-message struct.
irc-message-targetprocedureGet 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"irc-message-textprocedureGet the text content of a message (alias for trailing).
(irc-message-text msg) ; => "Hello world"parse-irc-messageprocedureParse 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 ...>make-irc-commandprocedureCreate an IRC command string from parts.
(make-irc-command "PRIVMSG" "#channel" "Hello world")
; => "PRIVMSG #channel :Hello world"irc-command->stringprocedureConvert an IRC command to a wire-format string (with CRLF).
(irc-command->string "PRIVMSG" "#channel" "Hello")
; => "PRIVMSG #channel :Hello\r\n"