[Server] Move buddy and ignore list writes into the database interface (#7827)

cmdAddToList/cmdRemoveFromList issued raw SQL against the buddy and ignore tables and looked accounts up through getUserIdInDB, a method that only exists on the MySQL implementation. Add getUserId plus add/remove operations to Server_DatabaseInterface, implement them in Servatrice_DatabaseInterface over the shared single-row helpers, and let the handler ask the injected interface instead of the concrete class.
This commit is contained in:
BruebachL 2026-11-10 12:16:20 +01:00 • committed by GitHub
parent 90b3013db6
commit 52d8f84ec8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 77 additions and 12 deletions

View file

@ -67,6 +67,8 @@ private:
* backup key is unset or the sealed value does not fit the column. */
QString sealLegacyBackup(const QString &storedName, const QString &credential);
bool isStrictModeEnabled(bool &ok) const;
bool addToList(const QString &table, int userId, int targetId);
bool removeFromList(const QString &table, int userId, int targetId);
protected:
AuthenticationResult checkUserPassword(Server_ProtocolHandler *handler,
@ -113,6 +115,11 @@ public:
/** @brief Drop every legacy password backup that has not been used within the TTL. */
void purgeExpiredLegacyBackups();
int getUserIdInDB(const QString &name);
int getUserId(const QString &name) override;
bool addToBuddyList(int userId, int targetId) override;
bool removeFromBuddyList(int userId, int targetId) override;
bool addToIgnoreList(int userId, int targetId) override;
bool removeFromIgnoreList(int userId, int targetId) override;
QMap<QString, ServerInfo_User> getBuddyList(const QString &name) override;
QMap<QString, ServerInfo_User> getIgnoreList(const QString &name) override;
bool isInBuddyList(const QString &whoseList, const QString &who) override;