Handle updates of userstatus

This commit is contained in:
bodqhrohro 2019-11-29 13:48:27 +02:00
parent dbe87fafa8
commit 6332ea6d28

View file

@ -1,6 +1,8 @@
package telegram
import (
"dev.narayana.im/narayana/telegabber/xmpp/gateway"
log "github.com/sirupsen/logrus"
"github.com/zelenin/go-tdlib/client"
)
@ -22,6 +24,12 @@ func (c *Client) updateHandler() {
uhOh()
}
c.updateUser(typedUpdate)
case client.TypeUpdateUserStatus:
typedUpdate, ok := update.(*client.UpdateUserStatus)
if !ok {
uhOh()
}
c.updateUserStatus(typedUpdate)
default:
// log only handled types
continue
@ -36,3 +44,7 @@ func (c *Client) updateUser(update *client.UpdateUser) {
cache.users[update.User.Id] = update.User
c.processStatusUpdate(update.User.Id, &update.User.Status)
}
func (c *Client) updateUserStatus(update *client.UpdateUserStatus) {
c.processStatusUpdate(update.UserId, &update.Status, gateway.SPImmed(false))
}