gmessages/libgm/typing_handler.go
Tulir Asokan 1615e146b6 Update library
Co-authored-by: zero <108243503+0xzer@users.noreply.github.com>
2023-07-09 14:49:55 +03:00

26 lines
606 B
Go

package libgm
import (
"go.mau.fi/mautrix-gmessages/libgm/pblite"
"go.mau.fi/mautrix-gmessages/libgm/binary"
"go.mau.fi/mautrix-gmessages/libgm/events"
)
func (c *Client) handleTypingEvent(res *pblite.Response, data *binary.TypingData) {
typingType := data.Type
var evt events.TypingEvent
switch typingType {
case binary.TypingTypes_STARTED_TYPING:
evt = events.NewStartedTyping(data)
case binary.TypingTypes_STOPPED_TYPING:
evt = events.NewStoppedTyping(data)
default:
c.Logger.Debug().Any("data", data).Msg("got unknown TypingData evt")
}
if evt != nil {
c.triggerEvent(evt)
}
}