pub use irc_proto::chan::ChannelExt;
pub use irc_proto::command::Command;
pub use irc_proto::message::Message;
pub use irc_proto::prefix::Prefix;
pub use irc_proto::response::Response;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct CtcpMessage {
pub command: String,
pub arg: String,
}
impl CtcpMessage {
#[must_use]
pub fn parse(text: &str) -> Option<Self> {
let text = text.strip_prefix('\x01')?;
let text = text.strip_suffix('\x01').unwrap_or(text);
let (command, arg) = text.split_once(' ').unwrap_or((text, ""));
Some(CtcpMessage {
command: command.to_ascii_uppercase(),
arg: arg.to_string(),
})
}
}