diff options
author | bodqhrohro <bodqhrohro@gmail.com> | 2020-01-05 16:03:10 +0300 |
---|---|---|
committer | bodqhrohro <bodqhrohro@gmail.com> | 2020-01-05 16:03:10 +0300 |
commit | b8fcac6ae24dd5e07f366741f0f282f33b18b503 (patch) | |
tree | 61f86331504dcd079f1a964d103ec299aa70f351 /telegram/utils.go | |
parent | a435a0a556cb88fe1fcc7e3bf860b45530d895e7 (diff) |
Resend chat statuses on probe presence
Diffstat (limited to 'telegram/utils.go')
-rw-r--r-- | telegram/utils.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/telegram/utils.go b/telegram/utils.go index b3e815f..8de1f5f 100644 --- a/telegram/utils.go +++ b/telegram/utils.go @@ -14,6 +14,7 @@ import ( "strings" "time" + "dev.narayana.im/narayana/telegabber/telegram/cache" "dev.narayana.im/narayana/telegabber/xmpp/gateway" log "github.com/sirupsen/logrus" @@ -129,8 +130,8 @@ func (c *Client) userStatusToText(status client.UserStatus) (string, string) { return show, textStatus } -// set contact status -func (c *Client) processStatusUpdate(chatID int64, status string, show string, args ...args.V) error { +// ProcessStatusUpdate sets contact status +func (c *Client) ProcessStatusUpdate(chatID int64, status string, show string, args ...args.V) error { if !c.Online() { return nil } @@ -171,6 +172,8 @@ func (c *Client) processStatusUpdate(chatID int64, status string, show string, a } } + c.cache.SetStatus(chatID, show, status) + gateway.SendPresence( c.xmpp, c.jid, @@ -512,3 +515,8 @@ func (c *Client) ProcessOutgoingMessage(chatID int64, text string, messageID int } } } + +// StatusesRange proxies the following function from unexported cache +func (c *Client) StatusesRange() chan *cache.Status { + return c.cache.StatusesRange() +} |