X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Fclientauthhandler.cpp;h=6661119fa41637dda84571f9751972ba74a7b776;hp=a390ab6a5d946b4da8cafa9019764dddb9423ca1;hb=e55d141896130c9b82bfae60e23078b8b765d85e;hpb=64cf9f9b8a737dad5f29447805d4004cfd03c454 diff --git a/src/client/clientauthhandler.cpp b/src/client/clientauthhandler.cpp index a390ab6a..6661119f 100644 --- a/src/client/clientauthhandler.cpp +++ b/src/client/clientauthhandler.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2013 by the Quassel Project * + * Copyright (C) 2005-2014 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -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))); @@ -166,14 +160,14 @@ void ClientAuthHandler::onProtocolVersionMismatch(int actual, int expected) { emit errorPopup(tr("The Quassel Core you are trying to connect to is too old!
" "We need at least protocol v%1, but the core speaks v%2 only.").arg(expected, actual)); - requestDisconnect(); + requestDisconnect(tr("Incompatible protocol version, connection to core refused")); } void ClientAuthHandler::handle(const ClientDenied &msg) { emit errorPopup(msg.errorString); - requestDisconnect(); + requestDisconnect(tr("The core refused connection from this client")); }