X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fcore.cpp;h=4e7632fc04d56839006ecb38df3cc528610ecc24;hp=1e1bb61d2ecc78e050779136c5874d15f0d21696;hb=453ccab6ade4a21c7aa3c331af893c91468250a4;hpb=6053070613c26ad5744d2a3e84ac5ee305a5a8d6 diff --git a/src/core/core.cpp b/src/core/core.cpp index 1e1bb61d..4e7632fc 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -18,8 +18,6 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#include -#include #include #include "core.h" @@ -53,23 +51,25 @@ void Core::destroy() { Core::Core() : storage(0) { _startTime = QDateTime::currentDateTime().toUTC(); // for uptime :) - loadTranslation(QLocale::system()); - -#ifndef Q_WS_MAC + Quassel::loadTranslation(QLocale::system()); // FIXME: MIGRATION 0.3 -> 0.4: Move database and core config to new location // Move settings, note this does not delete the old files -#ifdef Q_WS_WIN - QSettings::Format format = QSettings::IniFormat; +#ifdef Q_WS_MAC + QSettings newSettings("quassel-irc.org", "quasselcore"); #else - QSettings::Format format = QSettings::NativeFormat; -#endif - QString newFilePath = Quassel::configDirPath() + "quasselcore" - + ((format == QSettings::NativeFormat) ? QLatin1String(".conf") : QLatin1String(".ini")); - QSettings newSettings(newFilePath, format); - if(newSettings.value("Config/Version").toUInt() != 1) { - qWarning() << "\n\n*** IMPORTANT: Config and data file locations have changed. Attempting to auto-migrate your core settings..."; +# ifdef Q_WS_WIN + QSettings::Format format = QSettings::IniFormat; +# else + QSettings::Format format = QSettings::NativeFormat; +# endif + QString newFilePath = Quassel::configDirPath() + "quasselcore" + + ((format == QSettings::NativeFormat) ? QLatin1String(".conf") : QLatin1String(".ini")); + QSettings newSettings(newFilePath, format); +#endif /* Q_WS_MAC */ + + if(newSettings.value("Config/Version").toUInt() == 0) { # ifdef Q_WS_MAC QString org = "quassel-irc.org"; # else @@ -77,11 +77,13 @@ Core::Core() : storage(0) { # endif QSettings oldSettings(org, "Quassel Core"); if(oldSettings.allKeys().count()) { + qWarning() << "\n\n*** IMPORTANT: Config and data file locations have changed. Attempting to auto-migrate your core settings..."; foreach(QString key, oldSettings.allKeys()) newSettings.setValue(key, oldSettings.value(key)); newSettings.setValue("Config/Version", 1); - qWarning() << "* Your core settings have been migrated to" << newFilePath; + qWarning() << "* Your core settings have been migrated to" << newSettings.fileName(); +#ifndef Q_WS_MAC /* we don't need to move the db and cert for mac */ #ifdef Q_OS_WIN32 QString quasselDir = qgetenv("APPDATA") + "/quassel/"; #elif defined Q_WS_MAC @@ -112,12 +114,20 @@ Core::Core() : storage(0) { else qWarning() << "!!! Moving your certificate has failed. Please move it manually into" << Quassel::configDirPath(); } +#endif /* !Q_WS_MAC */ qWarning() << "*** Migration completed.\n\n"; } } -#endif /* !Q_WS_MAC */ // MIGRATION end + // check settings version + // so far, we only have 1 + CoreSettings s; + if(s.version() != 1) { + qCritical() << "Invalid core settings version, terminating!"; + exit(EXIT_FAILURE); + } + // Register storage backends here! registerStorageBackend(new SqliteStorage(this)); @@ -148,10 +158,21 @@ void Core::init() { } Core::~Core() { + _server.close(); + _v6server.close(); foreach(QTcpSocket *socket, blocksizes.keys()) { socket->disconnectFromHost(); // disconnect non authed clients } - qDeleteAll(sessions); + + + foreach(SessionThread *session, sessions) { + session->stopSession(); + session->wait(); + delete session; + qDebug() << "next"; + } + +// qDeleteAll(sessions); qDeleteAll(_storageBackends); }