connect(&socket, selectOverload<QAbstractSocket::SocketError>(&QAbstractSocket::error), this, &CoreNetwork::onSocketError);
connect(&socket, &QAbstractSocket::stateChanged, this, &CoreNetwork::onSocketStateChanged);
connect(&socket, &QIODevice::readyRead, this, &CoreNetwork::onSocketHasData);
-#ifdef HAVE_SSL
connect(&socket, &QSslSocket::encrypted, this, &CoreNetwork::onSocketInitialized);
connect(&socket, selectOverload<const QList<QSslError>&>(&QSslSocket::sslErrors), this, &CoreNetwork::onSslErrors);
-#endif
connect(this, &CoreNetwork::newEvent, coreSession()->eventManager(), &EventManager::postEvent);
// Custom rate limiting
// hostname of the server. Qt's DNS cache also isn't used by the proxy so we don't need to refresh the entry.
QHostInfo::fromName(server.host);
}
-#ifdef HAVE_SSL
if (server.useSsl) {
CoreIdentity* identity = identityPtr();
if (identity) {
else {
socket.connectToHost(server.host, server.port);
}
-#else
- socket.connectToHost(server.host, server.port);
-#endif
}
void CoreNetwork::disconnectFromIrc(bool requested, const QString& reason, bool withReconnect)
Server server = usedServer();
-#ifdef HAVE_SSL
// Non-SSL connections enter here only once, always emit socketInitialized(...) in these cases
// SSL connections call socketInitialized() twice, only emit socketInitialized(...) on the first (not yet encrypted) run
if (!server.useSsl || !socket.isEncrypted()) {
// We'll finish setup once we're encrypted, and called again
return;
}
-#else
- emit socketInitialized(identity, localAddress(), localPort(), peerAddress(), peerPort(), _socketId);
-#endif
socket.setSocketOption(QAbstractSocket::KeepAliveOption, true);
// If SASL mechanisms specified, limit to what's accepted for authentication
// if the current identity has a cert set, use SASL EXTERNAL
// FIXME use event
-#ifdef HAVE_SSL
if (!identityPtr()->sslCert().isNull()) {
if (saslMaybeSupports(IrcCap::SaslMech::EXTERNAL)) {
// EXTERNAL authentication supported, send request
}
}
else {
-#endif
if (saslMaybeSupports(IrcCap::SaslMech::PLAIN)) {
// PLAIN authentication supported, send request
// Only working with PLAIN atm, blowfish later
));
sendNextCap();
}
-#ifdef HAVE_SSL
}
-#endif
}
}
void CoreNetwork::beginCapNegotiation()
{
- if (!capNegotiationInProgress()) {
+ if (!capsPendingNegotiation()) {
// No capabilities are queued for request, determine the reason why
QString capStatusMsg;
if (caps().empty()) {
void CoreNetwork::sendNextCap()
{
- if (capNegotiationInProgress()) {
+ if (capsPendingNegotiation()) {
// Request the next set of capabilities and remove them from the list
putRawLine(serverEncode(QString("CAP REQ :%1").arg(takeQueuedCaps())));
}
}
}
-#ifdef HAVE_SSL
void CoreNetwork::onSslErrors(const QList<QSslError>& sslErrors)
{
Server server = usedServer();
}
}
-#endif // HAVE_SSL
-
void CoreNetwork::checkTokenBucket()
{
if (_skipMessageRates) {