aboutsummaryrefslogtreecommitdiff
path: root/telegram/client.go
diff options
context:
space:
mode:
authorBohdan Horbeshko <bodqhrohro@gmail.com>2022-01-03 06:54:13 +0300
committerBohdan Horbeshko <bodqhrohro@gmail.com>2022-01-03 06:54:13 +0300
commitf4e4692a94b24f661d67cd4e98ac9b2ca9928c0f (patch)
treeb9c917fc783b6bdd15fa2781b607b34b3cf51606 /telegram/client.go
parent462a537021f471579877eceb1dd6c47154d8052d (diff)
Multiple resources handling
Diffstat (limited to 'telegram/client.go')
-rw-r--r--telegram/client.go15
1 files changed, 9 insertions, 6 deletions
diff --git a/telegram/client.go b/telegram/client.go
index c4c97ff..097354d 100644
--- a/telegram/client.go
+++ b/telegram/client.go
@@ -42,12 +42,13 @@ type Client struct {
options []client.Option
me *client.User
- xmpp *xmpp.Component
- jid string
- Session *persistence.Session
- content *config.TelegramContentConfig
- cache *cache.Cache
- online bool
+ xmpp *xmpp.Component
+ jid string
+ Session *persistence.Session
+ resources map[string]bool
+ content *config.TelegramContentConfig
+ cache *cache.Cache
+ online bool
locks clientLocks
}
@@ -55,6 +56,7 @@ type Client struct {
type clientLocks struct {
authorizationReady sync.WaitGroup
chatMessageLocks map[int64]*sync.Mutex
+ resourcesLock sync.Mutex
}
// NewClient instantiates a Telegram App
@@ -104,6 +106,7 @@ func NewClient(conf config.TelegramConfig, jid string, component *xmpp.Component
xmpp: component,
jid: jid,
Session: session,
+ resources: make(map[string]bool),
content: &conf.Content,
cache: cache.NewCache(),
options: options,