X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcore%2Fabstractsqlstorage.cpp;h=9fe95b9d05dbda19a847ac21da4a7cef81eaed9e;hb=6a63070246d89aa2a2474e3a9a1035fa889ad77e;hp=c100d4ef008ac797ab6ec6a573541c9164202b34;hpb=3cf5c49e7753be48a994917fe898730add4292b1;p=quassel.git diff --git a/src/core/abstractsqlstorage.cpp b/src/core/abstractsqlstorage.cpp index c100d4ef..9fe95b9d 100644 --- a/src/core/abstractsqlstorage.cpp +++ b/src/core/abstractsqlstorage.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2016 by the Quassel Project * + * Copyright (C) 2005-2018 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -116,9 +116,11 @@ void AbstractSqlStorage::dbConnect(QSqlDatabase &db) } -Storage::State AbstractSqlStorage::init(const QVariantMap &settings) +Storage::State AbstractSqlStorage::init(const QVariantMap &settings, + const QProcessEnvironment &environment, + bool loadFromEnvironment) { - setConnectionProperties(settings); + setConnectionProperties(settings, environment, loadFromEnvironment); _debug = Quassel::isOptionSet("debug"); @@ -144,7 +146,7 @@ Storage::State AbstractSqlStorage::init(const QVariantMap &settings) } } - quInfo() << qPrintable(displayName()) << "Storage Backend is ready. Quassel Schema Version:" << installedSchemaVersion(); + quInfo() << qPrintable(displayName()) << "storage backend is ready. Schema version:" << installedSchemaVersion(); return IsReady; } @@ -192,9 +194,10 @@ QStringList AbstractSqlStorage::setupQueries() } -bool AbstractSqlStorage::setup(const QVariantMap &settings) +bool AbstractSqlStorage::setup(const QVariantMap &settings, const QProcessEnvironment &environment, + bool loadFromEnvironment) { - setConnectionProperties(settings); + setConnectionProperties(settings, environment, loadFromEnvironment); QSqlDatabase db = logDb(); if (!db.isOpen()) { qCritical() << "Unable to setup Logging Backend!"; @@ -409,6 +412,8 @@ QString AbstractSqlMigrator::migrationObject(MigrationObject moType) return "IrcServer"; case UserSetting: return "UserSetting"; + case CoreState: + return "CoreState"; }; return QString(); } @@ -502,6 +507,10 @@ bool AbstractSqlMigrationReader::migrateTo(AbstractSqlMigrationWriter *writer) if (!transferMo(UserSetting, userSettingMo)) return false; + CoreStateMO coreStateMO; + if (!transferMo(CoreState, coreStateMO)) + return false; + if (!_writer->postProcess()) abortMigration(); return finalizeMigration(); @@ -584,3 +593,13 @@ bool AbstractSqlMigrationReader::transferMo(MigrationObject moType, T &mo) qDebug() << "Done."; return true; } + +uint qHash(const SenderData &key) { + return qHash(QString(key.sender + "\n" + key.realname + "\n" + key.avatarurl)); +} + +bool operator==(const SenderData &a, const SenderData &b) { + return a.sender == b.sender && + a.realname == b.realname && + a.avatarurl == b.avatarurl; +}