mirror of
https://github.com/RGBCube/serenity
synced 2025-07-08 22:47:34 +00:00
IRCClient: Add support for /HOP and /TOPIC commands
This commit is contained in:
parent
c56c8c8953
commit
2de2f49abc
2 changed files with 21 additions and 0 deletions
|
@ -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]);
|
||||
|
|
|
@ -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&);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue