class Crirc::Protocol::Message
- Crirc::Protocol::Message
- Reference
- Object
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.crConstant 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
-
#argument_list : Array(String)
The arguments formated into an Array.
-
#arguments : String | Nil
The arguments as a string ("user1 +0", "pingmessage", ...)
-
#command : String
The command ("PRIVMSG", "PING", ...)
-
#message : String | Nil
The last argument when ":" ("This is a privmsg message", ...)
-
#raw : String
Raw message without parsing
-
#raw_arguments : String
Concatenation of
#arguments
and#message
. -
#source : String
Source of the message (ex: "0", "abc@xyz", ...)
Constructor Detail
Instance Method Detail
def argument_list : Array(String)
#
The arguments formated into an Array.
msg.argument_list # => ["user1", "+0"]
def raw_arguments : String
#
Concatenation of #arguments
and #message
.
If the message exists, it is preceded by ':'
msg.raw_arguments # => "user1 +0 :do something"