mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-10 03:53:26 -08:00
[Server] Expose moderation history reads on the database interface (#7829)
The ban/warn history, session, alt-account, and moderator-login readers existed only on Servatrice_DatabaseInterface, so the socket handler had to hold the concrete class to call them and to ask checkSql() whether the store was reachable. Declare them on Server_DatabaseInterface with empty-list defaults and a checkSql() that reports ready for stores without a connection, mark the Servatrice implementations as overrides, and let those five commands ask the injected interface.
This commit is contained in:
parent
52d8f84ec8
commit
2ca3117765
4 changed files with 56 additions and 16 deletions
|
|
@ -91,7 +91,7 @@ public:
|
|||
const QString &userName,
|
||||
const QString &password);
|
||||
bool openDatabase();
|
||||
bool checkSql();
|
||||
bool checkSql() override;
|
||||
QSqlQuery *prepareQuery(const QString &queryText);
|
||||
bool execSqlQuery(QSqlQuery *query);
|
||||
const QSqlDatabase &getDatabase()
|
||||
|
|
@ -214,10 +214,10 @@ public:
|
|||
const QString &newPassword,
|
||||
bool newPasswordNeedsHash) override;
|
||||
void setForcePasswordChange(const QString &user, bool force) override;
|
||||
QList<ServerInfo_Ban> getUserBanHistory(const QString userName);
|
||||
QList<ServerInfo_Ban> getUserBanHistory(const QString &userName) override;
|
||||
bool
|
||||
addWarning(const QString userName, const QString adminName, const QString warningReason, const QString clientID);
|
||||
QList<ServerInfo_Warning> getUserWarnHistory(const QString userName);
|
||||
QList<ServerInfo_Warning> getUserWarnHistory(const QString &userName) override;
|
||||
QList<ServerInfo_ChatMessage> getMessageLogHistory(const QString &user,
|
||||
const QString &ipaddress,
|
||||
const QString &gamename,
|
||||
|
|
@ -231,7 +231,7 @@ public:
|
|||
int offset = 0,
|
||||
const QString &beforeTime = QString(),
|
||||
bool *hasMore = nullptr);
|
||||
QList<ServerInfo_UserSession> getUserSessions(const QString &userName, int limit);
|
||||
QList<ServerInfo_UserSession> getUserSessions(const QString &userName, int limit) override;
|
||||
bool getPrivateChatHistory(int callerId,
|
||||
const QString &callerName,
|
||||
int peerId,
|
||||
|
|
@ -245,8 +245,8 @@ public:
|
|||
bool useEmail = true,
|
||||
bool useClientId = true,
|
||||
bool useIp = true,
|
||||
int sessionMonths = 6);
|
||||
QList<ServerInfo_ModeratorLogin> getModeratorLastLogins();
|
||||
int sessionMonths = 6) override;
|
||||
QList<ServerInfo_ModeratorLogin> getModeratorLastLogins() override;
|
||||
|
||||
// Uptime snapshot as recorded by Servatrice::statusUpdate() into the
|
||||
// {prefix}_uptime table. valid is false when no snapshot exists yet.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue