core: Remove leftover getAuthUserName and SQL
authorShane Synan <digitalcircuit36939@gmail.com>
Wed, 22 Aug 2018 01:51:40 +0000 (20:51 -0500)
committerManuel Nickschas <sputnick@quassel-irc.org>
Thu, 23 Aug 2018 00:21:31 +0000 (02:21 +0200)
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.

src/core/SQL/PostgreSQL/select_authusername.sql [deleted file]
src/core/SQL/SQLite/select_authusername.sql [deleted file]
src/core/core.h
src/core/postgresqlstorage.cpp
src/core/postgresqlstorage.h
src/core/sql.qrc
src/core/sqlitestorage.cpp
src/core/sqlitestorage.h
src/core/storage.h

diff --git a/src/core/SQL/PostgreSQL/select_authusername.sql b/src/core/SQL/PostgreSQL/select_authusername.sql
deleted file mode 100644 (file)
index 00aaf77..0000000
+++ /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 (file)
index 00aaf77..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-SELECT username
-FROM quasseluser
-WHERE userid = :userid
index 102252b..8d02d9e 100644 (file)
@@ -556,13 +556,6 @@ public:
         return instance()->_storage->setBufferLastSeenMsg(user, bufferId, msgId);
     }
 
         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
 
     //! Get a usable sysident for the given user in oidentd-strict mode
     /** \param user    The user to retrieve the sysident for
index 74d0b8f..fb8157a 100644 (file)
@@ -2024,21 +2024,6 @@ QMap<UserId, QString> 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();
 // void PostgreSqlStorage::safeExec(QSqlQuery &query) {
 //   qDebug() << "PostgreSqlStorage::safeExec";
 //   qDebug() << "   executing:\n" << query.executedQuery();
index f27675d..ff6e7b8 100644 (file)
@@ -120,7 +120,6 @@ public slots:
 
     /* Sysident handling */
     QMap<UserId, QString> getAllAuthUserNames() override;
 
     /* Sysident handling */
     QMap<UserId, QString> getAllAuthUserNames() override;
-    QString getAuthUserName(UserId user) override;
 
 protected:
     bool initDbSession(QSqlDatabase &db) override;
 
 protected:
     bool initDbSession(QSqlDatabase &db) override;
index 7a88399..381abfe 100644 (file)
@@ -35,7 +35,6 @@
     <file>./SQL/PostgreSQL/select_all_authusernames.sql</file>
     <file>./SQL/PostgreSQL/select_authenticator.sql</file>
     <file>./SQL/PostgreSQL/select_authuser.sql</file>
     <file>./SQL/PostgreSQL/select_all_authusernames.sql</file>
     <file>./SQL/PostgreSQL/select_authenticator.sql</file>
     <file>./SQL/PostgreSQL/select_authuser.sql</file>
-    <file>./SQL/PostgreSQL/select_authusername.sql</file>
     <file>./SQL/PostgreSQL/select_bufferByName.sql</file>
     <file>./SQL/PostgreSQL/select_bufferExists.sql</file>
     <file>./SQL/PostgreSQL/select_buffer_bufferactivities.sql</file>
     <file>./SQL/PostgreSQL/select_bufferByName.sql</file>
     <file>./SQL/PostgreSQL/select_bufferExists.sql</file>
     <file>./SQL/PostgreSQL/select_buffer_bufferactivities.sql</file>
     <file>./SQL/SQLite/select_all_authusernames.sql</file>
     <file>./SQL/SQLite/select_authenticator.sql</file>
     <file>./SQL/SQLite/select_authuser.sql</file>
     <file>./SQL/SQLite/select_all_authusernames.sql</file>
     <file>./SQL/SQLite/select_authenticator.sql</file>
     <file>./SQL/SQLite/select_authuser.sql</file>
-    <file>./SQL/SQLite/select_authusername.sql</file>
     <file>./SQL/SQLite/select_bufferByName.sql</file>
     <file>./SQL/SQLite/select_bufferExists.sql</file>
     <file>./SQL/SQLite/select_buffer_bufferactivities.sql</file>
     <file>./SQL/SQLite/select_bufferByName.sql</file>
     <file>./SQL/SQLite/select_bufferExists.sql</file>
     <file>./SQL/SQLite/select_buffer_bufferactivities.sql</file>
index 1503015..2eae156 100644 (file)
@@ -2178,25 +2178,6 @@ QMap<UserId, QString> 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";
 QString SqliteStorage::backlogFile()
 {
     return Quassel::configDirPath() + "quassel-storage.sqlite";
index 0ab7921..d52cdfa 100644 (file)
@@ -121,7 +121,6 @@ public slots:
 
     /* Sysident handling */
     QMap<UserId, QString> getAllAuthUserNames() override;
 
     /* Sysident handling */
     QMap<UserId, QString> getAllAuthUserNames() override;
-    QString getAuthUserName(UserId user) override;
 
 protected:
     void setConnectionProperties(const QVariantMap &properties,
 
 protected:
     void setConnectionProperties(const QVariantMap &properties,
index 3930a95..df0a3a0 100644 (file)
@@ -533,12 +533,6 @@ public slots:
      */
     virtual QMap<UserId, QString> getAllAuthUserNames() = 0;
 
      */
     virtual QMap<UserId, QString> 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 &);
 signals:
     //! Sent when a new BufferInfo is created, or an existing one changed somehow.
     void bufferInfoUpdated(UserId user, const BufferInfo &);