Handle updates of userstatus
This commit is contained in:
parent
dbe87fafa8
commit
6332ea6d28
|
@ -1,6 +1,8 @@
|
||||||
package telegram
|
package telegram
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"dev.narayana.im/narayana/telegabber/xmpp/gateway"
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"github.com/zelenin/go-tdlib/client"
|
"github.com/zelenin/go-tdlib/client"
|
||||||
)
|
)
|
||||||
|
@ -22,6 +24,12 @@ func (c *Client) updateHandler() {
|
||||||
uhOh()
|
uhOh()
|
||||||
}
|
}
|
||||||
c.updateUser(typedUpdate)
|
c.updateUser(typedUpdate)
|
||||||
|
case client.TypeUpdateUserStatus:
|
||||||
|
typedUpdate, ok := update.(*client.UpdateUserStatus)
|
||||||
|
if !ok {
|
||||||
|
uhOh()
|
||||||
|
}
|
||||||
|
c.updateUserStatus(typedUpdate)
|
||||||
default:
|
default:
|
||||||
// log only handled types
|
// log only handled types
|
||||||
continue
|
continue
|
||||||
|
@ -36,3 +44,7 @@ func (c *Client) updateUser(update *client.UpdateUser) {
|
||||||
cache.users[update.User.Id] = update.User
|
cache.users[update.User.Id] = update.User
|
||||||
c.processStatusUpdate(update.User.Id, &update.User.Status)
|
c.processStatusUpdate(update.User.Id, &update.User.Status)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Client) updateUserStatus(update *client.UpdateUserStatus) {
|
||||||
|
c.processStatusUpdate(update.UserId, &update.Status, gateway.SPImmed(false))
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue