Skip to content

Commit

Permalink
FEAT(client): Clear local mutes on Mumble restart
Browse files Browse the repository at this point in the history
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 mumble-voip#5983
  • Loading branch information
Hartmnt committed Jun 6, 2024
1 parent a32229f commit 9b81fac
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/mumble/Database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
1 change: 1 addition & 0 deletions src/mumble/Database.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/mumble/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9b81fac

Please sign in to comment.