mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-30 05:08:56 +00:00
IRCClient: Add support for /HOP and /TOPIC commands
This commit is contained in:
committed by
Andreas Kling
parent
c56c8c8953
commit
2de2f49abc
@@ -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]);
|
||||
|
||||
Reference in New Issue
Block a user