Add mnemonic mute controls
This commit is contained in:
+20
-2
@@ -14,7 +14,13 @@ func (ti TreeItem) String() string {
|
||||
}
|
||||
if ti.User != nil {
|
||||
if ti.User.LocallyMuted() {
|
||||
return "[MUTED] " + esc(ti.User.Name)
|
||||
return "[LOCALLY MUTED] " + esc(ti.User.Name)
|
||||
}
|
||||
if ti.User.Muted {
|
||||
return "[SERVER MUTED] " + esc(ti.User.Name)
|
||||
}
|
||||
if ti.User.SelfMuted {
|
||||
return "[SELF MUTED] " + esc(ti.User.Name)
|
||||
}
|
||||
// Calculate total volume as percentage
|
||||
boostPercent := float32(ti.User.Boost()-1) * 10
|
||||
@@ -76,6 +82,14 @@ func (b *Barnard) resetVolume(users []*gumble.User) {
|
||||
b.AddOutputLine("Volume: could not save reset: " + err.Error())
|
||||
return
|
||||
}
|
||||
if b.Client.Self != nil {
|
||||
for _, user := range users {
|
||||
if user != nil && user.Session == b.Client.Self.Session {
|
||||
b.setSelfMute(false)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
b.withStream(func(stream *gumbleopenal.Stream) {
|
||||
for _, u := range users {
|
||||
stream.UpdateUserGain(u)
|
||||
@@ -148,7 +162,11 @@ func (b *Barnard) TreeItemBuild(item uiterm.TreeItem) []uiterm.TreeItem {
|
||||
totalVolume := user.Volume()*100 + boostPercent
|
||||
display := fmt.Sprintf("%s [%.0f%%]", esc(user.Name), totalVolume)
|
||||
if user.LocallyMuted() {
|
||||
display = "[MUTED] " + display
|
||||
display = "[LOCALLY MUTED] " + display
|
||||
} else if user.Muted {
|
||||
display = "[SERVER MUTED] " + display
|
||||
} else if user.SelfMuted {
|
||||
display = "[SELF MUTED] " + display
|
||||
}
|
||||
ul = append(ul, userDisplay{user: user, name: user.Name, session: user.Session, display: display})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user