aboutsummaryrefslogtreecommitdiff
path: root/telegram/connect.go
diff options
context:
space:
mode:
authorBohdan Horbeshko <bodqhrohro@gmail.com>2024-01-25 02:52:40 +0300
committerBohdan Horbeshko <bodqhrohro@gmail.com>2024-01-25 02:52:40 +0300
commitb40ccf4a4d1391ba1f67a159697fea859e2a92fd (patch)
tree44d9638a98db6513ff450ab2839e993c3613c03b /telegram/connect.go
parent4532748c8458971151dfb6b535b11b2a3e17a372 (diff)
Fix presences sent with no resource
Diffstat (limited to 'telegram/connect.go')
-rw-r--r--telegram/connect.go11
1 files changed, 3 insertions, 8 deletions
diff --git a/telegram/connect.go b/telegram/connect.go
index b1b8b10..6c88cd1 100644
--- a/telegram/connect.go
+++ b/telegram/connect.go
@@ -2,7 +2,6 @@ package telegram
import (
"github.com/pkg/errors"
- "strconv"
"time"
"dev.narayana.im/narayana/telegabber/xmpp/gateway"
@@ -159,7 +158,7 @@ func (c *Client) Connect(resource string) error {
}
gateway.SubscribeToTransport(c.xmpp, c.jid)
- gateway.SendPresence(c.xmpp, c.jid, gateway.SPStatus("Logged in as: "+c.Session.Login))
+ c.sendPresence(gateway.SPStatus("Logged in as: "+c.Session.Login))
}()
return nil
@@ -228,12 +227,8 @@ func (c *Client) Disconnect(resource string, quit bool) bool {
// we're offline (unsubscribe if logout)
for _, id := range c.cache.ChatsKeys() {
- gateway.SendPresence(
- c.xmpp,
- c.jid,
- gateway.SPFrom(strconv.FormatInt(id, 10)),
- gateway.SPType("unavailable"),
- )
+ args := gateway.SimplePresence(id, "unavailable")
+ c.sendPresence(args...)
}
c.close()