class Crirc::Protocol::Message

Overview

Message is the object that parse the raw TCP body as a IRC message.

Message are a IRC core part. They contain a command, the arguments, and the message (last argument in the IRC protocol).

TODO improve the message to appear in as the last argument. cf: fast_irc

Defined in:

crirc/protocol/message.cr

Constant Summary

R_ARG = "(?: (?<arg>#{R_ARG_ONE}(?: #{R_ARG_ONE})*))"
R_ARG_ONE = "(?:[^: ][^ ]*)"
R_CMD = "(?<cmd>[A-Z]+|\\d{3})"
R_MSG = "(?: \\:(?<msg>.+)?)"
R_SRC = "(\\:(?<src>[^[:space:]]+) )"

Constructors

Instance Method Summary

Constructor Detail

def self.new(raw) #

[View source]

Instance Method Detail

def argument_list : Array(String) #

The arguments formated into an Array.

msg.argument_list # => ["user1", "+0"]

[View source]
def arguments : String? #

The arguments as a string ("user1 +0", "pingmessage", ...)


[View source]
def command : String #

The command ("PRIVMSG", "PING", ...)


[View source]
def message : String? #

The last argument when ":" ("This is a privmsg message", ...)


[View source]
def raw : String #

Raw message without parsing


[View source]
def raw_arguments : String #

Concatenation of #arguments and #message. If the message exists, it is preceded by ':'

msg.raw_arguments # => "user1 +0 :do something"

[View source]
def source : String #

Source of the message (ex: "0", "abc@xyz", ...)


[View source]