X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Fclientauthhandler.cpp;h=6661119fa41637dda84571f9751972ba74a7b776;hp=b122e2f43950f346e2bc5e91e3fea4ca2664e59a;hb=e55d141896130c9b82bfae60e23078b8b765d85e;hpb=9d54503555534a2c554f09a33df6afa33d6308ec diff --git a/src/client/clientauthhandler.cpp b/src/client/clientauthhandler.cpp index b122e2f4..6661119f 100644 --- a/src/client/clientauthhandler.cpp +++ b/src/client/clientauthhandler.cpp @@ -78,7 +78,7 @@ void ClientAuthHandler::connectToCore() setSocket(socket); // handled by the base class for now; may need to rethink for protocol detection //connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(onSocketError(QAbstractSocket::SocketError))); - //connect(socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), SLOT(onSocketStateChanged(QAbstractSocket::SocketState))); + connect(socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), SLOT(onSocketStateChanged(QAbstractSocket::SocketState))); connect(socket, SIGNAL(connected()), SLOT(onSocketConnected())); emit statusMessage(tr("Connecting to %1...").arg(_account.accountName())); @@ -87,45 +87,37 @@ void ClientAuthHandler::connectToCore() // TODO: handle protocol detection -// This method might go away anyway, unless we really need our own states... -/* void ClientAuthHandler::onSocketStateChanged(QAbstractSocket::SocketState socketState) { - qDebug() << Q_FUNC_INFO << socketState; QString text; - AuthHandler::State state = UnconnectedState; switch(socketState) { case QAbstractSocket::UnconnectedState: text = tr("Disconnected"); - state = UnconnectedState; + // Ensure the disconnected() signal is sent even if we haven't reached the Connected state yet. + // The baseclass implementation will make sure to only send the signal once. + onSocketDisconnected(); break; case QAbstractSocket::HostLookupState: text = tr("Looking up %1...").arg(_account.hostName()); - state = HostLookupState; break; case QAbstractSocket::ConnectingState: text = tr("Connecting to %1...").arg(_account.hostName()); - state = ConnectingState; break; case QAbstractSocket::ConnectedState: text = tr("Connected to %1").arg(_account.hostName()); - state = ConnectedState; break; case QAbstractSocket::ClosingState: text = tr("Disconnecting from %1...").arg(_account.hostName()); - state = ClosingState; break; default: break; } if (!text.isEmpty()) { - setState(state); emit statusMessage(text); } } -*/ // TODO: handle protocol detection /* @@ -144,6 +136,8 @@ void ClientAuthHandler::onSocketConnected() return; } + socket()->setSocketOption(QAbstractSocket::KeepAliveOption, true); + _peer = new LegacyPeer(this, socket(), this); connect(_peer, SIGNAL(transferProgress(int,int)), SIGNAL(transferProgress(int,int)));