X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fcore.cpp;h=2b4b6a3edf5bfd94df516da8253e0a45bc46b22e;hp=29174b62b7ba973a18b8ffa1b4d4905fa49ebfcc;hb=f9a73e3ad8142212028a39b26ced62456e575b7a;hpb=ec7436e9be67c03be7f24b4e362db204c8d8315c diff --git a/src/core/core.cpp b/src/core/core.cpp index 29174b62..2b4b6a3e 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -201,6 +201,9 @@ void Core::init() { connect(&_server, SIGNAL(newConnection()), this, SLOT(incomingConnection())); connect(&_v6server, SIGNAL(newConnection()), this, SLOT(incomingConnection())); if(!startListening()) exit(1); // TODO make this less brutal + + if(Quassel::isOptionSet("oidentd")) + _oidentdConfigGenerator = new OidentdConfigGenerator(this); } Core::~Core() { @@ -240,6 +243,7 @@ void Core::restoreState() { return; } */ + QVariantList activeSessions = s.coreState().toMap()["ActiveSessions"].toList(); if(activeSessions.count() > 0) { quInfo() << "Restoring previous core state..."; @@ -262,7 +266,7 @@ QString Core::setupCoreForInternalUsage() { } setupData["AdminUser"] = "AdminUser"; setupData["AdminPasswd"] = QString::number(pass); - setupData["Backend"] = _storageBackends[_storageBackends.keys().first()]->displayName(); + setupData["Backend"] = QString("SQLite"); // mono client currently needs sqlite return setupCore(setupData); } @@ -272,8 +276,7 @@ QString Core::setupCore(QVariantMap setupData) { if(user.isEmpty() || password.isEmpty()) { return tr("Admin user or password not set."); } - _configured = initStorage(setupData, true); - if(!_configured) { + if(_configured || !(_configured = initStorage(setupData, true))) { return tr("Could not setup storage!"); } CoreSettings s; @@ -396,40 +399,39 @@ bool Core::startListening() { ); } else { switch(addr.protocol()) { - case QAbstractSocket::IPv4Protocol: - if(_server.listen(addr, port)) { + case QAbstractSocket::IPv6Protocol: + if(_v6server.listen(addr, port)) { quInfo() << qPrintable( - tr("Listening for GUI clients on IPv4 %1 port %2 using protocol version %3") + tr("Listening for GUI clients on IPv6 %1 port %2 using protocol version %3") .arg(addr.toString()) - .arg(_server.serverPort()) + .arg(_v6server.serverPort()) .arg(Quassel::buildInfo().protocolVersion) ); success = true; } else quWarning() << qPrintable( - tr("Could not open IPv4 interface %1:%2: %3") + tr("Could not open IPv6 interface %1:%2: %3") .arg(addr.toString()) .arg(port) - .arg(_server.errorString())); + .arg(_v6server.errorString())); break; - case QAbstractSocket::IPv6Protocol: - if(_v6server.listen(addr, port)) { + case QAbstractSocket::IPv4Protocol: + if(_server.listen(addr, port)) { quInfo() << qPrintable( - tr("Listening for GUI clients on IPv6 %1 port %2 using protocol version %3") + tr("Listening for GUI clients on IPv4 %1 port %2 using protocol version %3") .arg(addr.toString()) - .arg(_v6server.serverPort()) + .arg(_server.serverPort()) .arg(Quassel::buildInfo().protocolVersion) ); success = true; } else { - // if v4 succeeded on Any, the port will be already in use - don't display the error then - // FIXME: handle this more sanely, make sure we can listen to both v4 and v6 by default! - if(!success || _v6server.serverError() != QAbstractSocket::AddressInUseError) + // if v6 succeeded on Any, the port will be already in use - don't display the error then + if(!success || _server.serverError() != QAbstractSocket::AddressInUseError) quWarning() << qPrintable( - tr("Could not open IPv6 interface %1:%2: %3") + tr("Could not open IPv4 interface %1:%2: %3") .arg(addr.toString()) .arg(port) - .arg(_v6server.errorString())); + .arg(_server.errorString())); } break; default: @@ -914,7 +916,7 @@ void Core::changeUserPass(const QString &username) { } if(_configured && _storage->updateUser(userId, password)) { - out << "Password changed successfuly!" << endl; + out << "Password changed successfully!" << endl; } else { qWarning() << "Failed to change password!"; }