aboutsummaryrefslogtreecommitdiff
path: root/telegram
diff options
context:
space:
mode:
authorBohdan Horbeshko <bodqhrohro@gmail.com>2022-02-08 20:43:51 +0300
committerBohdan Horbeshko <bodqhrohro@gmail.com>2022-02-08 20:43:51 +0300
commit06104797341533bd96ab2030d110bd843cea5098 (patch)
tree4187611cd939158e6fd210d35156f41158205577 /telegram
parent76364388ad2d7baa0718dff50902eacd4c090edf (diff)
Attach resource to presences to prevent unwanted behaviour of some clients
Diffstat (limited to 'telegram')
-rw-r--r--telegram/client.go7
-rw-r--r--telegram/utils.go1
2 files changed, 8 insertions, 0 deletions
diff --git a/telegram/client.go b/telegram/client.go
index 5220c2d..9a98be7 100644
--- a/telegram/client.go
+++ b/telegram/client.go
@@ -48,6 +48,7 @@ type Client struct {
options []client.Option
me *client.User
+ resource string
xmpp *xmpp.Component
jid string
Session *persistence.Session
@@ -115,8 +116,14 @@ func NewClient(conf config.TelegramConfig, jid string, component *xmpp.Component
IgnoreFileNames: false,
}
+ resource := conf.Tdlib.Client.DeviceModel
+ if resource == "" {
+ resource = "telegabber"
+ }
+
return &Client{
parameters: &parameters,
+ resource: resource,
xmpp: component,
jid: jid,
Session: session,
diff --git a/telegram/utils.go b/telegram/utils.go
index e2fbe3b..a0e8147 100644
--- a/telegram/utils.go
+++ b/telegram/utils.go
@@ -217,6 +217,7 @@ func (c *Client) ProcessStatusUpdate(chatID int64, status string, show string, o
gateway.SPShow(show),
gateway.SPStatus(status),
gateway.SPPhoto(photo),
+ gateway.SPResource(c.resource),
gateway.SPImmed(gateway.SPImmed.Get(oldArgs)),
}
if presenceType != "" {