mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:58:11 +00:00
IRCClient: Ask the user which IRC server to connect to on startup.
This commit is contained in:
parent
76ce68ac48
commit
cc20eef7ef
3 changed files with 20 additions and 8 deletions
|
@ -27,10 +27,8 @@ enum IRCNumeric {
|
|||
RPL_ENDOFNAMES = 366,
|
||||
};
|
||||
|
||||
IRCClient::IRCClient(const String& address, int port)
|
||||
: m_hostname(address)
|
||||
, m_port(port)
|
||||
, m_nickname("anon")
|
||||
IRCClient::IRCClient()
|
||||
: m_nickname("seren1ty")
|
||||
, m_client_window_list_model(IRCWindowListModel::create(*this))
|
||||
, m_log(IRCLogBuffer::create())
|
||||
{
|
||||
|
@ -41,13 +39,18 @@ IRCClient::~IRCClient()
|
|||
{
|
||||
}
|
||||
|
||||
void IRCClient::set_server(const String &hostname, int port)
|
||||
{
|
||||
m_hostname = hostname;
|
||||
m_port = port;
|
||||
}
|
||||
|
||||
bool IRCClient::connect()
|
||||
{
|
||||
if (m_socket->is_connected())
|
||||
ASSERT_NOT_REACHED();
|
||||
|
||||
IPv4Address ipv4_address(127, 0, 0, 1);
|
||||
bool success = m_socket->connect(GSocketAddress(ipv4_address), m_port);
|
||||
bool success = m_socket->connect(m_hostname, m_port);
|
||||
if (!success)
|
||||
return false;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue