47 lines
966 B
Go
47 lines
966 B
Go
package main
|
|
|
|
// Voice state tracking for the TUI client.
|
|
|
|
// VoiceState holds the current voice connection state.
|
|
type VoiceState struct {
|
|
Connected bool
|
|
RoomName string
|
|
LiveKitURL string
|
|
Token string
|
|
Muted bool
|
|
Deafened bool
|
|
Participants []VoiceParticipant
|
|
}
|
|
|
|
// VoiceParticipant is someone in the current voice channel.
|
|
type VoiceParticipant struct {
|
|
UserID string
|
|
Username string
|
|
State string // connected, disconnected
|
|
}
|
|
|
|
// VoiceStatusText returns a human-readable status for the status bar.
|
|
func (vs *VoiceState) StatusText() string {
|
|
if !vs.Connected {
|
|
return ""
|
|
}
|
|
muteIcon := "🔊"
|
|
if vs.Muted {
|
|
muteIcon = "🔇"
|
|
}
|
|
return muteIcon + " " + vs.RoomName
|
|
}
|
|
|
|
// ToggleMute flips the muted state.
|
|
func (vs *VoiceState) ToggleMute() {
|
|
vs.Muted = !vs.Muted
|
|
}
|
|
|
|
// ToggleDeafen flips the deafened state.
|
|
func (vs *VoiceState) ToggleDeafen() {
|
|
vs.Deafened = !vs.Deafened
|
|
if vs.Deafened {
|
|
vs.Muted = true
|
|
}
|
|
}
|