1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:28:12 +00:00

IRCClient: Colorize some channel messages (joins, parts, topics)

This commit is contained in:
Andreas Kling 2019-03-18 20:56:45 +01:00
parent 794c81626e
commit 55aa819077
11 changed files with 60 additions and 23 deletions

View file

@ -369,7 +369,7 @@ void IRCClient::handle_join(const Message& msg)
void IRCClient::handle_part(const Message& msg)
{
if (msg.arguments.size() != 1)
if (msg.arguments.size() < 1)
return;
auto prefix_parts = msg.prefix.split('!');
if (prefix_parts.size() < 1)
@ -393,12 +393,11 @@ void IRCClient::handle_topic(const Message& msg)
void IRCClient::handle_rpl_topic(const Message& msg)
{
if (msg.arguments.size() != 3)
if (msg.arguments.size() < 3)
return;
auto& nick = msg.arguments[0];
auto& channel_name = msg.arguments[1];
auto& topic = msg.arguments[2];
ensure_channel(channel_name).handle_topic(nick, topic);
ensure_channel(channel_name).handle_topic({ }, topic);
// FIXME: Handle RPL_TOPICWHOTIME so we can know who set it and when.
}
@ -501,7 +500,7 @@ void IRCClient::handle_rpl_topicwhotime(const Message& msg)
tm->tm_sec
);
}
ensure_channel(channel_name).add_message(0, "", String::format("Topic set by %s at %s", nick.characters(), setat.characters()));
ensure_channel(channel_name).add_message(String::format("*** (set by %s at %s)", nick.characters(), setat.characters()), Color::DarkBlue);
}
void IRCClient::register_subwindow(IRCWindow& subwindow)