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

IRCClient: Add ability to send query messages.

You can't open a query yet, but if someone starts one with you, you can
respond at least.
This commit is contained in:
Andreas Kling 2019-03-15 18:02:38 +01:00
parent 7e3673f710
commit 08c15be0ca
5 changed files with 21 additions and 3 deletions

View file

@ -9,7 +9,7 @@ IRCAppWindow::IRCAppWindow()
: GWindow()
, m_client("127.0.0.1", 6667)
{
set_title(String::format("IRC Client: %s:%d", m_client.hostname().characters(), m_client.port()));
set_title(String::format("IRC Client: %s@%s:%d", m_client.nickname().characters(), m_client.hostname().characters(), m_client.port()));
set_rect(200, 200, 600, 400);
setup_client();
setup_widgets();
@ -25,10 +25,18 @@ void IRCAppWindow::setup_client()
m_client.join_channel("#test");
};
m_client.on_channel_message = [this] (const String& channel_name) {
ensure_window(IRCClientWindow::Channel, channel_name);
};
m_client.on_join = [this] (const String& channel_name) {
ensure_window(IRCClientWindow::Channel, channel_name);
};
m_client.on_query_message = [this] (const String& name) {
ensure_window(IRCClientWindow::Query, name);
};
m_client.connect();
}