diff --git a/Applications/IRCClient/IRCClient.cpp b/Applications/IRCClient/IRCClient.cpp index a857b23821..5481afd49c 100644 --- a/Applications/IRCClient/IRCClient.cpp +++ b/Applications/IRCClient/IRCClient.cpp @@ -312,6 +312,11 @@ void IRCClient::add_server_message(const String& text, Color color) m_server_subwindow->did_add_message(); } +void IRCClient::send_topic(const String& channel_name, const String& text) +{ + send(String::format("TOPIC %s :%s\r\n", channel_name.characters(), text.characters())); +} + void IRCClient::send_privmsg(const String& target, const String& text) { send(String::format("PRIVMSG %s :%s\r\n", target.characters(), text.characters())); @@ -676,6 +681,21 @@ void IRCClient::handle_user_command(const String& input) part_channel(parts[1]); return; } + if (command == "/HOP") { + if (parts.size() >= 2) { + part_channel(parts[1]); + join_channel(parts[1]); + } + return; + } + if (command == "/TOPIC") { + if (parts.size() < 3) + return; + auto channel = parts[1]; + auto topic = input.view().substring_view_starting_after_substring(channel); + send_topic(channel, topic); + return; + } if (command == "/QUERY") { if (parts.size() >= 2) { auto& query = ensure_query(parts[1]); diff --git a/Applications/IRCClient/IRCClient.h b/Applications/IRCClient/IRCClient.h index 1c8cff8a8e..991f93d504 100644 --- a/Applications/IRCClient/IRCClient.h +++ b/Applications/IRCClient/IRCClient.h @@ -133,6 +133,7 @@ private: void send_pong(const String& server); void send_privmsg(const String& target, const String&); void send_notice(const String& target, const String&); + void send_topic(const String& channel_name, const String&); void send_whois(const String&); void process_line(ByteBuffer&&); void handle_join(const Message&);