X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=core%2Fcore.cpp;h=2a8d4cc2b5c212e3092e76899b4d521a603f000c;hp=b1815d9c517282decfe8128d66d59ccfb252650c;hb=b27b03c4239150189b7ae8963ca2e8c9b1a0ce4a;hpb=7ec4585cecc74ce8d9a94b0e52f00a96d105e79e diff --git a/core/core.cpp b/core/core.cpp index b1815d9c..2a8d4cc2 100644 --- a/core/core.cpp +++ b/core/core.cpp @@ -56,8 +56,11 @@ void Core::init() { connect(&server, SIGNAL(newConnection()), this, SLOT(incomingConnection())); //startListening(); // FIXME if(Global::runMode == Global::Monolithic) { // TODO Make GUI user configurable - guiUser = storage->validateUser("Default", "password"); - if(!guiUser) guiUser = storage->addUser("Default", "password"); + try { + guiUser = storage->validateUser("Default", "password"); + } catch(Storage::AuthError) { + guiUser = storage->addUser("Default", "password"); + } Q_ASSERT(guiUser); Global::setGuiUser(guiUser); createSession(guiUser); @@ -253,8 +256,8 @@ void Core::recvProxySignal(CoreSignal sig, QVariant arg1, QVariant arg2, QVarian CoreSession::CoreSession(UserId uid, Storage *_storage) : user(uid), storage(_storage) { coreProxy = new CoreProxy(); - connect(coreProxy, SIGNAL(send(CoreSignal, QVariant, QVariant, QVariant)), this, SIGNAL(proxySignal(CoreSignal, QVariant, QVariant, QVariant))); + connect(coreProxy, SIGNAL(send(CoreSignal, QVariant, QVariant, QVariant)), this, SIGNAL(proxySignal(CoreSignal, QVariant, QVariant, QVariant))); connect(coreProxy, SIGNAL(requestServerStates()), this, SIGNAL(serverStateRequested())); connect(coreProxy, SIGNAL(gsRequestConnect(QStringList)), this, SLOT(connectToIrc(QStringList))); connect(coreProxy, SIGNAL(gsUserInput(BufferId, QString)), this, SLOT(msgFromGui(BufferId, QString))); @@ -267,7 +270,6 @@ CoreSession::CoreSession(UserId uid, Storage *_storage) : user(uid), storage(_st connect(storage, SIGNAL(bufferIdUpdated(BufferId)), coreProxy, SLOT(csUpdateBufferId(BufferId))); connect(Global::instance(), SIGNAL(dataUpdatedRemotely(UserId, QString)), this, SLOT(globalDataUpdated(UserId, QString))); connect(Global::instance(), SIGNAL(dataPutLocally(UserId, QString)), this, SLOT(globalDataUpdated(UserId, QString))); - } CoreSession::~CoreSession() { @@ -299,6 +301,10 @@ void CoreSession::connectToIrc(QStringList networks) { connect(this, SIGNAL(connectToIrc(QString)), server, SLOT(connectToIrc(QString))); connect(this, SIGNAL(disconnectFromIrc(QString)), server, SLOT(disconnectFromIrc(QString))); connect(this, SIGNAL(msgFromGui(QString, QString, QString)), server, SLOT(userInput(QString, QString, QString))); + + connect(server, SIGNAL(connected(QString)), this, SLOT(serverConnected(QString))); + connect(server, SIGNAL(disconnected(QString)), this, SLOT(serverDisconnected(QString))); + connect(server, SIGNAL(serverState(QString, VarMap)), coreProxy, SLOT(csServerState(QString, VarMap))); //connect(server, SIGNAL(displayMsg(Message)), this, SLOT(recvMessageFromServer(Message))); connect(server, SIGNAL(displayMsg(Message::Type, QString, QString, QString, quint8)), this, SLOT(recvMessageFromServer(Message::Type, QString, QString, QString, quint8))); @@ -313,7 +319,7 @@ void CoreSession::connectToIrc(QStringList networks) { connect(server, SIGNAL(queryRequested(QString, QString)), coreProxy, SLOT(csQueryRequested(QString, QString))); // TODO add error handling connect(server, SIGNAL(connected(QString)), coreProxy, SLOT(csServerConnected(QString))); - connect(server, SIGNAL(disconnected(QString)), this, SLOT(serverDisconnected(QString))); + connect(server, SIGNAL(disconnected(QString)), coreProxy, SLOT(csServerDisconnected(QString))); server->start(); servers[net] = server; @@ -322,6 +328,10 @@ void CoreSession::connectToIrc(QStringList networks) { } } +void CoreSession::serverConnected(QString net) { + storage->getBufferId(userId(), net); // create status buffer +} + void CoreSession::serverDisconnected(QString net) { delete servers[net]; servers.remove(net);