From 9b81fac3b57fb171e9203173863a27e9c831f64e Mon Sep 17 00:00:00 2001 From: Hartmnt Date: Thu, 6 Jun 2024 13:09:32 +0000 Subject: [PATCH] FEAT(client): Clear local mutes on Mumble restart Previously, local muted users would be muted persistently basically forever. This meant that local muting a client could end up being confusing down the line (e.g days later) when the user forgot that they muted someone. As a means of self-moderation though, local mutes should also not expire when the muted client reconnects or something similar. This commit clears the all local mutes in the client when Mumble starts. Fixes #5983 --- src/mumble/Database.cpp | 6 ++++++ src/mumble/Database.h | 1 + src/mumble/main.cpp | 1 + 3 files changed, 8 insertions(+) diff --git a/src/mumble/Database.cpp b/src/mumble/Database.cpp index 0768182b26d..fc366530a17 100644 --- a/src/mumble/Database.cpp +++ b/src/mumble/Database.cpp @@ -399,6 +399,12 @@ void Database::setLocalMuted(const QString &hash, bool muted) { execQueryAndLogFailure(query); } +void Database::clearLocalMuted() { + QSqlQuery query(db); + query.prepare(QLatin1String("DELETE FROM `muted`")); + execQueryAndLogFailure(query); +} + ChannelFilterMode Database::getChannelFilterMode(const QByteArray &server_cert_digest, const unsigned int channel_id) { QSqlQuery query(db); diff --git a/src/mumble/Database.h b/src/mumble/Database.h index c5643deeb3f..c57110c99c2 100644 --- a/src/mumble/Database.h +++ b/src/mumble/Database.h @@ -48,6 +48,7 @@ class Database : public QObject { bool isLocalMuted(const QString &hash); void setLocalMuted(const QString &hash, bool muted); + void clearLocalMuted(); float getUserLocalVolume(const QString &hash); void setUserLocalVolume(const QString &hash, float volume); diff --git a/src/mumble/main.cpp b/src/mumble/main.cpp index be28b37cf8e..204b9c4a077 100644 --- a/src/mumble/main.cpp +++ b/src/mumble/main.cpp @@ -658,6 +658,7 @@ int main(int argc, char **argv) { // Initialize database Global::get().db = new Database(QLatin1String("main")); + Global::get().db->clearLocalMuted(); #ifdef USE_ZEROCONF // Initialize zeroconf