aboutsummaryrefslogtreecommitdiff
path: root/telegram/client.go
diff options
context:
space:
mode:
Diffstat (limited to 'telegram/client.go')
-rw-r--r--telegram/client.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/telegram/client.go b/telegram/client.go
index 8813df0..5220c2d 100644
--- a/telegram/client.go
+++ b/telegram/client.go
@@ -34,6 +34,12 @@ func stringToLogConstant(c string) int32 {
return level
}
+// DelayedStatus describes an online status expiring on timeout
+type DelayedStatus struct {
+ TimestampOnline int64
+ TimestampExpired int64
+}
+
// Client stores the metadata for lazily invoked TDlib instance
type Client struct {
client *client.Client
@@ -50,6 +56,9 @@ type Client struct {
cache *cache.Cache
online bool
+ DelayedStatuses map[int64]*DelayedStatus
+ DelayedStatusesLock sync.Mutex
+
locks clientLocks
}
@@ -115,6 +124,7 @@ func NewClient(conf config.TelegramConfig, jid string, component *xmpp.Component
content: &conf.Content,
cache: cache.NewCache(),
options: options,
+ DelayedStatuses: make(map[int64]*DelayedStatus),
locks: clientLocks{
chatMessageLocks: make(map[int64]*sync.Mutex),
},