X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fcorenetwork.cpp;h=954565cfc87d70b767227f48c8872b720a1dbc9b;hp=e0d4fa6eb90a771854e7cf4612230323d4ae21db;hb=155eda45e862f42a0b9444d615002deda461328d;hpb=9d54503555534a2c554f09a33df6afa33d6308ec diff --git a/src/core/corenetwork.cpp b/src/core/corenetwork.cpp index e0d4fa6e..954565cf 100644 --- a/src/core/corenetwork.cpp +++ b/src/core/corenetwork.cpp @@ -44,7 +44,6 @@ CoreNetwork::CoreNetwork(const NetworkId &networkid, CoreSession *session) _requestedUserModes('-') { _autoReconnectTimer.setSingleShot(true); - _socketCloseTimer.setSingleShot(true); connect(&_socketCloseTimer, SIGNAL(timeout()), this, SLOT(socketCloseTimeout())); setPingInterval(networkConfig()->pingInterval()); @@ -183,8 +182,9 @@ void CoreNetwork::connectToIrc(bool reconnecting) socket.setProxy(QNetworkProxy::NoProxy); } + enablePingTimeout(); + #ifdef HAVE_SSL - socket.setProtocol((QSsl::SslProtocol)server.sslVersion); if (server.useSsl) { CoreIdentity *identity = identityPtr(); if (identity) { @@ -264,11 +264,14 @@ void CoreNetwork::putCmd(const QString &cmd, const QList ¶ms, co msg += ":" + prefix + " "; msg += cmd.toUpper().toAscii(); - for (int i = 0; i < params.size() - 1; i++) { - msg += " " + params[i]; + for (int i = 0; i < params.size(); i++) { + msg += " "; + + if (i == params.size() - 1 && (params[i].contains(' ') || (!params[i].isEmpty() && params[i][0] == ':'))) + msg += ":"; + + msg += params[i]; } - if (!params.isEmpty()) - msg += " :" + params.last(); putRawLine(msg); } @@ -437,7 +440,9 @@ void CoreNetwork::socketInitialized() if (server.useSsl && !socket.isEncrypted()) return; #endif - +#if QT_VERSION >= 0x040600 + socket.setSocketOption(QAbstractSocket::KeepAliveOption, true); +#endif CoreIdentity *identity = identityPtr(); if (!identity) { qCritical() << "Identity invalid!"; @@ -447,8 +452,6 @@ void CoreNetwork::socketInitialized() emit socketInitialized(identity, localAddress(), localPort(), peerAddress(), peerPort()); - enablePingTimeout(); - // TokenBucket to avoid sending too much at once _messageDelay = 2200; // this seems to be a safe value (2.2 seconds delay) _burstSize = 5;