aboutsummaryrefslogtreecommitdiff
path: root/telegram/utils.go
diff options
context:
space:
mode:
Diffstat (limited to 'telegram/utils.go')
-rw-r--r--telegram/utils.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/telegram/utils.go b/telegram/utils.go
index 66f217a..d6b112d 100644
--- a/telegram/utils.go
+++ b/telegram/utils.go
@@ -774,3 +774,23 @@ func (c *Client) DownloadFile(id int32, priority int32, synchronous bool) (*clie
Synchronous: synchronous,
})
}
+
+// subscribe to a Telegram ID
+func (c *Client) subscribeToID(id int64, chat *client.Chat) {
+ var args []args.V
+ args = append(args, gateway.SPFrom(strconv.FormatInt(id, 10)))
+ args = append(args, gateway.SPType("subscribe"))
+
+ if chat == nil {
+ chat, _, _ = c.GetContactByID(id, nil)
+ }
+ if chat != nil {
+ args = append(args, gateway.SPNickname(chat.Title))
+ }
+
+ gateway.SendPresence(
+ c.xmpp,
+ c.jid,
+ args...,
+ )
+}