aboutsummaryrefslogtreecommitdiff
path: root/telegram/handlers.go
diff options
context:
space:
mode:
authorbodqhrohro <bodqhrohro@gmail.com>2019-11-29 14:48:27 +0300
committerbodqhrohro <bodqhrohro@gmail.com>2019-11-29 14:48:27 +0300
commit6332ea6d28ff850b46a2f7eff592c92ff2c38232 (patch)
tree5f63ecf46b96123088b33f9ae3a681c3ad8677d4 /telegram/handlers.go
parentdbe87fafa8fb3c38d6cb22ac335cc76b70b607a6 (diff)
Handle updates of userstatus
Diffstat (limited to 'telegram/handlers.go')
-rw-r--r--telegram/handlers.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/telegram/handlers.go b/telegram/handlers.go
index 1195831..348fd9a 100644
--- a/telegram/handlers.go
+++ b/telegram/handlers.go
@@ -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))
+}