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

IRCClient: Add handling for server responses and BANLIST command

This commit is contained in:
Brendan Coles 2020-04-05 10:36:35 +00:00 committed by Andreas Kling
parent 1e67efc5c1
commit a1b57216b8
4 changed files with 118 additions and 5 deletions

View file

@ -168,6 +168,14 @@ void IRCAppWindow::setup_actions()
m_client->handle_invite_user_action(window->channel().name(), input_box->text_value());
});
m_banlist_action = GUI::Action::create("Ban list", [this](auto&) {
auto* window = m_client->current_window();
if (!window || window->type() != IRCWindow::Type::Channel) {
return;
}
m_client->handle_banlist_action(window->channel().name());
});
m_voice_user_action = GUI::Action::create("Voice user", [this](auto&) {
auto* window = m_client->current_window();
if (!window || window->type() != IRCWindow::Type::Channel) {
@ -252,6 +260,7 @@ void IRCAppWindow::setup_menus()
auto& channel_menu = menubar->add_menu("Channel");
channel_menu.add_action(*m_change_topic_action);
channel_menu.add_action(*m_invite_user_action);
channel_menu.add_action(*m_banlist_action);
channel_menu.add_separator();
channel_menu.add_action(*m_voice_user_action);
channel_menu.add_action(*m_devoice_user_action);
@ -329,6 +338,7 @@ void IRCAppWindow::update_gui_actions()
bool is_open_channel = window && window->type() == IRCWindow::Type::Channel && window->channel().is_open();
m_change_topic_action->set_enabled(is_open_channel);
m_invite_user_action->set_enabled(is_open_channel);
m_banlist_action->set_enabled(is_open_channel);
m_voice_user_action->set_enabled(is_open_channel);
m_devoice_user_action->set_enabled(is_open_channel);
m_op_user_action->set_enabled(is_open_channel);