The complete source code of IdealIRC
http://www.idealirc.org/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.7 KiB
51 lines
1.7 KiB
/*
|
|
* IdealIRC Core - Internet Relay Chat API
|
|
* Copyright (C) 2021 Tom-Andre Barstad.
|
|
* This software is licensed under the Software Attribution License.
|
|
* See LICENSE for more information.
|
|
*/
|
|
|
|
#include "../IRCBase.h"
|
|
#include "../IRCBasePriv.h"
|
|
#include "../Commands.h"
|
|
|
|
void IRCBasePriv::connected(const asio::error_code& /*ec*/)
|
|
{
|
|
using namespace Command::IRC;
|
|
|
|
if (useSSL) {
|
|
asio::async_read_until(sslsock.value(), asio::dynamic_buffer(readbuf), "\r\n",
|
|
[this](const asio::error_code& e, std::size_t size){ read(e, size); });
|
|
}
|
|
else {
|
|
asio::async_read_until(sock.value(), asio::dynamic_buffer(readbuf), "\r\n",
|
|
[this](const asio::error_code& e, std::size_t size){ read(e, size); });
|
|
}
|
|
|
|
isConnected = true;
|
|
|
|
registeredV3support.clear();
|
|
writeNoMsg(Command::IRCv3::CAP, { Command::IRCv3::LS });
|
|
|
|
if (!password.empty())
|
|
write(Command::IRC::PASS, password);
|
|
|
|
write(Command::IRC::NICK, nickname);
|
|
write(Command::IRC::USER, {ident, "0", "*"}, realname);
|
|
|
|
if (useSSL) {
|
|
/* TODO test if these two below must be set _before_ ::connect happens, on Windows platform. */
|
|
sslsock->next_layer().set_option(asio::socket_base::reuse_address(true));
|
|
sslsock->next_layer().set_option(asio::socket_base::keep_alive(true));
|
|
}
|
|
else {
|
|
/* TODO test if these two below must be set _before_ ::connect happens, on Windows platform. */
|
|
sock->set_option(asio::socket_base::reuse_address(true));
|
|
sock->set_option(asio::socket_base::keep_alive(true));
|
|
}
|
|
|
|
if (sslExceptions.empty())
|
|
super.onConnected();
|
|
else
|
|
super.onConnectedWithSSLExceptions(sslExceptions);
|
|
}
|
|
|