1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 07:37:35 +00:00

IRC client setttings, Terminal settings, more WM settings

This commit is contained in:
Christopher Dumas 2019-05-25 16:43:15 -07:00 committed by Andreas Kling
parent 63486b8438
commit e3f81bce49
13 changed files with 89 additions and 53 deletions

View file

@ -52,12 +52,14 @@ void IRCAppWindow::setup_client()
m_client.join_channel("#test");
};
GInputBox input_box("Enter server:", "Connect to server", this);
auto result = input_box.exec();
if (result == GInputBox::ExecCancel)
::exit(0);
if (m_client.hostname() == "none") {
GInputBox input_box("Enter server:", "Connect to server", this);
auto result = input_box.exec();
if (result == GInputBox::ExecCancel)
::exit(0);
m_client.set_server(input_box.text_value(), 6667);
m_client.set_server(input_box.text_value(), 6667);
}
update_title();
bool success = m_client.connect();
ASSERT(success);

View file

@ -31,8 +31,12 @@ IRCClient::IRCClient()
: m_nickname("seren1ty")
, m_client_window_list_model(IRCWindowListModel::create(*this))
, m_log(IRCLogBuffer::create())
, m_config(CConfigFile::get_for_app("IRCClient"))
{
m_socket = new CTCPSocket(this);
m_nickname = m_config->read_entry("User", "Nickname", "seren1ty");
m_hostname = m_config->read_entry("Connection", "Server", "chat.freenode.net");
m_port = m_config->read_num_entry("Connection", "Port", 6667);
}
IRCClient::~IRCClient()
@ -53,8 +57,16 @@ void IRCClient::on_socket_connected()
send_user();
send_nick();
if (on_connect)
if (on_connect) {
auto channel_str = m_config->read_entry("Connection", "AutoJoinChannels", "#test");
dbgprintf("IRCClient: Channels to autojoin: %s\n", channel_str.characters());
auto channels = channel_str.split(',');
for (auto channel : channels) {
join_channel(channel);
dbgprintf("IRCClient: Auto joining channel: %s\n", channel.characters());
}
on_connect();
}
}
bool IRCClient::connect()

View file

@ -5,6 +5,7 @@
#include <AK/CircularQueue.h>
#include <AK/Function.h>
#include <LibCore/CTCPSocket.h>
#include <LibCore/CConfigFile.h>
#include "IRCLogBuffer.h"
#include "IRCWindow.h"
@ -111,7 +112,7 @@ private:
void on_socket_connected();
String m_hostname;
String m_hostname { "none" };
int m_port { 6667 };
CTCPSocket* m_socket { nullptr };
@ -127,4 +128,5 @@ private:
Retained<IRCWindowListModel> m_client_window_list_model;
Retained<IRCLogBuffer> m_log;
Retained<CConfigFile> m_config;
};