use pings to show self speaking

This commit is contained in:
aoife cassidy 2025-11-01 21:01:11 +01:00
parent 15740565d1
commit 9b1bf9c252
No known key found for this signature in database
GPG Key ID: 7184AC1C9835CE48
2 changed files with 9 additions and 0 deletions

View File

@ -125,6 +125,7 @@ func (au *Audio) ProcessInput(conn *ircevent.Connection, channel string) error {
}
str := base64.StdEncoding.EncodeToString(data[:n])
conn.Send("PING", "SPEAKING")
conn.Privmsg(channel, str)
}

View File

@ -101,6 +101,14 @@ func (m *model) setDeafen(is bool) {
}
func (m model) Init() tea.Cmd {
m.conn.AddCallback("PONG", func(e ircmsg.Message) {
if e.Params[1] == "SPEAKING" {
u := m.users[m.nick]
u.lastSpoke = time.Now()
m.users[m.nick] = u
}
})
m.conn.AddCallback("PRIVMSG", func(e ircmsg.Message) {
target, message := e.Params[0], e.Params[1]
if target != m.channel {