Make sure channels are initialized to unmuted when you join.

This commit is contained in:
Storm Dragon 2025-01-29 00:51:13 -05:00
parent c7362dfc36
commit 8c62babd48

View File

@ -56,6 +56,9 @@ func (b *Barnard) connect(reconnect bool) bool {
func (b *Barnard) OnConnect(e *gumble.ConnectEvent) { func (b *Barnard) OnConnect(e *gumble.ConnectEvent) {
b.Client = e.Client b.Client = e.Client
// Reset muted channels state on connect
b.MutedChannels = make(map[uint32]bool)
b.Ui.SetActive(uiViewInput) b.Ui.SetActive(uiViewInput)
b.UiTree.Rebuild() b.UiTree.Rebuild()
b.Ui.Refresh() b.Ui.Refresh()
@ -137,7 +140,7 @@ func (b *Barnard) OnUserChange(e *gumble.UserChangeEvent) {
if e.User != nil { if e.User != nil {
b.UserConfig.UpdateUser(e.User) b.UserConfig.UpdateUser(e.User)
// New code: Check if user is joining a muted channel // Check if user is joining a muted channel
if e.Type.Has(gumble.UserChangeConnected) || e.Type.Has(gumble.UserChangeChannel) { if e.Type.Has(gumble.UserChangeConnected) || e.Type.Has(gumble.UserChangeChannel) {
// If the channel is muted, mute the new user // If the channel is muted, mute the new user
if b.MutedChannels[e.User.Channel.ID] { if b.MutedChannels[e.User.Channel.ID] {