diff options
author | Brendan Coles <bcoles@gmail.com> | 2020-04-22 21:57:45 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-04-23 09:50:19 +0200 |
commit | 3c9693c6c7b6421c1e222fe9a7351e3a19ead5aa (patch) | |
tree | 18d7ed95098b0b97fe9bcae947e2b4d6793f0d23 /Applications/IRCClient/IRCClient.cpp | |
parent | c3b2bfabfecbd55e8e0b1a7c17c63f37bf2c9be3 (diff) | |
download | serenity-3c9693c6c7b6421c1e222fe9a7351e3a19ead5aa.zip |
IRCClient: Connect to IRC server URL specified in command line argument
The IRCClient application can now connect to a specified IRC server using
a URL with `irc://` protocol as a command line argument.
Diffstat (limited to 'Applications/IRCClient/IRCClient.cpp')
-rw-r--r-- | Applications/IRCClient/IRCClient.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Applications/IRCClient/IRCClient.cpp b/Applications/IRCClient/IRCClient.cpp index 4963e28aad..a052009e71 100644 --- a/Applications/IRCClient/IRCClient.cpp +++ b/Applications/IRCClient/IRCClient.cpp @@ -67,7 +67,7 @@ enum IRCNumeric { ERR_NICKNAMEINUSE = 433, }; -IRCClient::IRCClient() +IRCClient::IRCClient(String server, int port) : m_nickname("seren1ty") , m_client_window_list_model(IRCWindowListModel::create(*this)) , m_log(IRCLogBuffer::create()) @@ -76,8 +76,14 @@ IRCClient::IRCClient() struct passwd* user_pw = getpwuid(getuid()); m_socket = Core::TCPSocket::construct(this); m_nickname = m_config->read_entry("User", "Nickname", String::format("%s_seren1ty", user_pw->pw_name)); - m_hostname = m_config->read_entry("Connection", "Server", ""); - m_port = m_config->read_num_entry("Connection", "Port", 6667); + + if (server.is_empty()) { + m_hostname = m_config->read_entry("Connection", "Server", ""); + m_port = m_config->read_num_entry("Connection", "Port", 6667); + } else { + m_hostname = server; + m_port = port ? port : 6667; + } m_show_join_part_messages = m_config->read_bool_entry("Messaging", "ShowJoinPartMessages", 1); m_show_nick_change_messages = m_config->read_bool_entry("Messaging", "ShowNickChangeMessages", 1); |