From: Shane Synan Date: Wed, 22 Aug 2018 01:51:40 +0000 (-0500) Subject: core: Remove leftover getAuthUserName and SQL X-Git-Tag: 0.13-rc2~77 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=767e5f04ab1aff5ea98e9d3bf67d8f22043bf90c core: Remove leftover getAuthUserName and SQL Remove Storage::getAuthUserName(), including PostgreSQL and SQLite. Remove the corresponding select_authusername.sql files, too. This avoids unused code and may avoid confusion in the future. Any time a username-for-ID is needed, Core::_authUserNames should be consulted instead. NOTE: Before using Core::_authUserNames, public functions should be created and caching should always be done on core startup, instead of only when --strict-ident mode is enabled. --- diff --git a/src/core/SQL/PostgreSQL/select_authusername.sql b/src/core/SQL/PostgreSQL/select_authusername.sql deleted file mode 100644 index 00aaf77d..00000000 --- a/src/core/SQL/PostgreSQL/select_authusername.sql +++ /dev/null @@ -1,3 +0,0 @@ -SELECT username -FROM quasseluser -WHERE userid = :userid diff --git a/src/core/SQL/SQLite/select_authusername.sql b/src/core/SQL/SQLite/select_authusername.sql deleted file mode 100644 index 00aaf77d..00000000 --- a/src/core/SQL/SQLite/select_authusername.sql +++ /dev/null @@ -1,3 +0,0 @@ -SELECT username -FROM quasseluser -WHERE userid = :userid diff --git a/src/core/core.h b/src/core/core.h index 102252b6..8d02d9ed 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -556,13 +556,6 @@ public: return instance()->_storage->setBufferLastSeenMsg(user, bufferId, msgId); } - //! Get the auth username associated with a userId - /** \param user The user to retrieve the username for - * \return The username for the user - */ - static inline QString getAuthUserName(UserId user) { - return instance()->_storage->getAuthUserName(user); - } //! Get a usable sysident for the given user in oidentd-strict mode /** \param user The user to retrieve the sysident for diff --git a/src/core/postgresqlstorage.cpp b/src/core/postgresqlstorage.cpp index 74d0b8fe..fb8157ac 100644 --- a/src/core/postgresqlstorage.cpp +++ b/src/core/postgresqlstorage.cpp @@ -2024,21 +2024,6 @@ QMap PostgreSqlStorage::getAllAuthUserNames() } -QString PostgreSqlStorage::getAuthUserName(UserId user) -{ - QString authusername; - QSqlQuery query(logDb()); - query.prepare(queryString("select_authusername")); - query.bindValue(":userid", user.toInt()); - safeExec(query); - watchQuery(query); - - if (query.first()) { - authusername = query.value(0).toString(); - } - return authusername; -} - // void PostgreSqlStorage::safeExec(QSqlQuery &query) { // qDebug() << "PostgreSqlStorage::safeExec"; // qDebug() << " executing:\n" << query.executedQuery(); diff --git a/src/core/postgresqlstorage.h b/src/core/postgresqlstorage.h index f27675d3..ff6e7b8e 100644 --- a/src/core/postgresqlstorage.h +++ b/src/core/postgresqlstorage.h @@ -120,7 +120,6 @@ public slots: /* Sysident handling */ QMap getAllAuthUserNames() override; - QString getAuthUserName(UserId user) override; protected: bool initDbSession(QSqlDatabase &db) override; diff --git a/src/core/sql.qrc b/src/core/sql.qrc index 7a883993..381abfe8 100644 --- a/src/core/sql.qrc +++ b/src/core/sql.qrc @@ -35,7 +35,6 @@ ./SQL/PostgreSQL/select_all_authusernames.sql ./SQL/PostgreSQL/select_authenticator.sql ./SQL/PostgreSQL/select_authuser.sql - ./SQL/PostgreSQL/select_authusername.sql ./SQL/PostgreSQL/select_bufferByName.sql ./SQL/PostgreSQL/select_bufferExists.sql ./SQL/PostgreSQL/select_buffer_bufferactivities.sql @@ -172,7 +171,6 @@ ./SQL/SQLite/select_all_authusernames.sql ./SQL/SQLite/select_authenticator.sql ./SQL/SQLite/select_authuser.sql - ./SQL/SQLite/select_authusername.sql ./SQL/SQLite/select_bufferByName.sql ./SQL/SQLite/select_bufferExists.sql ./SQL/SQLite/select_buffer_bufferactivities.sql diff --git a/src/core/sqlitestorage.cpp b/src/core/sqlitestorage.cpp index 15030150..2eae1568 100644 --- a/src/core/sqlitestorage.cpp +++ b/src/core/sqlitestorage.cpp @@ -2178,25 +2178,6 @@ QMap SqliteStorage::getAllAuthUserNames() } -QString SqliteStorage::getAuthUserName(UserId user) { - QString authusername; - QSqlQuery query(logDb()); - query.prepare(queryString("select_authusername")); - query.bindValue(":userid", user.toInt()); - - lockForRead(); - safeExec(query); - watchQuery(query); - unlock(); - - if (query.first()) { - authusername = query.value(0).toString(); - } - - return authusername; -} - - QString SqliteStorage::backlogFile() { return Quassel::configDirPath() + "quassel-storage.sqlite"; diff --git a/src/core/sqlitestorage.h b/src/core/sqlitestorage.h index 0ab79213..d52cdfa2 100644 --- a/src/core/sqlitestorage.h +++ b/src/core/sqlitestorage.h @@ -121,7 +121,6 @@ public slots: /* Sysident handling */ QMap getAllAuthUserNames() override; - QString getAuthUserName(UserId user) override; protected: void setConnectionProperties(const QVariantMap &properties, diff --git a/src/core/storage.h b/src/core/storage.h index 3930a953..df0a3a09 100644 --- a/src/core/storage.h +++ b/src/core/storage.h @@ -533,12 +533,6 @@ public slots: */ virtual QMap getAllAuthUserNames() = 0; - //! Get the auth username associated with a userId - /** \param user The user to retrieve the username for - * \return The username for the user - */ - virtual QString getAuthUserName(UserId user) = 0; - signals: //! Sent when a new BufferInfo is created, or an existing one changed somehow. void bufferInfoUpdated(UserId user, const BufferInfo &);