X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fclient%2Fclientsyncer.cpp;h=601bff0368eb534f5ec1f03c2f33bc017b11d637;hb=25263b22ae90c5ac101decf62105884bc18eaeb1;hp=d77e7af3c9935a5ababfc9bc414cb9c192969dd7;hpb=28e33cd3255a838a045303bed073f4f9c40a3af4;p=quassel.git diff --git a/src/client/clientsyncer.cpp b/src/client/clientsyncer.cpp index d77e7af3..601bff03 100644 --- a/src/client/clientsyncer.cpp +++ b/src/client/clientsyncer.cpp @@ -59,6 +59,10 @@ void ClientSyncer::coreHasData() { emit connectionError(msg["Error"].toString()); disconnectFromCore(); return; + } else if(msg["MsgType"] == "CoreSetupAck") { + emit coreSetupSuccess(); + } else if(msg["MsgType"] == "CoreSetupReject") { + emit coreSetupFailed(msg["Error"].toString()); } else if(msg["MsgType"] == "ClientLoginReject") { emit loginFailed(msg["Error"].toString()); } else if(msg["MsgType"] == "ClientLoginAck") { @@ -107,7 +111,6 @@ void ClientSyncer::connectToCore(const QVariantMap &conn) { // emit coreConnectionError(tr("Already connected to Core!")); // return; // } - if(socket != 0) { socket->deleteLater(); socket = 0; @@ -169,16 +172,26 @@ void ClientSyncer::clientInitAck(const QVariantMap &msg) { // Core has accepted our version info and sent its own. Let's see if we accept it as well... if(msg["CoreBuild"].toUInt() < Global::coreBuildNeeded) { emit connectionError(tr("The Quassel Core you are trying to connect to is too old!
" - "Need at least a Core Version %1 (Build >= %2) to connect.").arg(Global::quasselVersion).arg(Global::quasselBuild)); + "Need at least a Core Version %1 (Build >= %2) to connect.").arg(Global::quasselVersion).arg(Global::coreBuildNeeded)); disconnectFromCore(); return; } emit connectionMsg(msg["CoreInfo"].toString()); - if(msg["LoginEnabled"].toBool()) { + if(!msg["Configured"].toBool()) { + // start wizard + emit startCoreSetup(msg["StorageBackends"].toList()); + } else if(msg["LoginEnabled"].toBool()) { emit startLogin(); } } +void ClientSyncer::doCoreSetup(const QVariant &setupData) { + QVariantMap setup; + setup["MsgType"] = "CoreSetupData"; + setup["SetupData"] = setupData; + SignalProxy::writeDataToDevice(socket, setup); +} + void ClientSyncer::loginToCore(const QString &user, const QString &passwd) { emit connectionMsg(tr("Logging in...")); QVariantMap clientLogin; @@ -193,7 +206,7 @@ void ClientSyncer::sessionStateReceived(const QVariantMap &state) { disconnect(this, SIGNAL(recvPartialItem(quint32, quint32)), this, SIGNAL(sessionProgress(quint32, quint32))); disconnect(socket, 0, this, 0); // rest of communication happens through SignalProxy //Client::signalProxy()->addPeer(socket); - Client::instance()->setConnectedToCore(socket); + Client::instance()->setConnectedToCore(socket, coreConnectionInfo["AccountId"].value()); syncToCore(state); }