Synchronize muted channel state

This commit is contained in:
Brandon McGinty (chatgpt)
2026-08-10 00:31:29 -04:00
committed by Brandon McGinty
parent 118799d112
commit 20c6997ab0
5 changed files with 46 additions and 14 deletions
+3 -1
View File
@@ -123,7 +123,9 @@ func (b *Barnard) OnConnect(e *gumble.ConnectEvent) {
b.Client = e.Client
// Reset muted channels state on connect
b.MutedChannelsMutex.Lock()
b.MutedChannels = make(map[uint32]bool)
b.MutedChannelsMutex.Unlock()
b.userChannels = make(map[uint32]*gumble.Channel)
b.RecordingMutex.Lock()
b.recordingAllowed = nil
@@ -279,7 +281,7 @@ func (b *Barnard) OnUserChange(e *gumble.UserChangeEvent) {
// Check if user is joining a muted channel
if e.Type.Has(gumble.UserChangeConnected) || e.Type.Has(gumble.UserChangeChannel) {
// If the channel is muted, ensure the user is muted
if b.MutedChannels[e.User.Channel.ID] {
if b.isChannelMuted(e.User.Channel.ID) {
// Only mute if not already muted
if !e.User.LocallyMuted() {
b.UserConfig.ToggleMute(e.User)