aboutsummaryrefslogtreecommitdiff
path: root/telegram/utils.go
diff options
context:
space:
mode:
Diffstat (limited to 'telegram/utils.go')
-rw-r--r--telegram/utils.go12
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()
+}