aboutsummaryrefslogtreecommitdiff
path: root/telegram/handlers.go
diff options
context:
space:
mode:
authorbodqhrohro <bodqhrohro@gmail.com>2020-01-10 12:13:25 +0300
committerbodqhrohro <bodqhrohro@gmail.com>2020-01-10 12:13:25 +0300
commit23f2a85301f2ee5af867fa774a406cf308733714 (patch)
tree45c7c1261737769b35fd28d9ee5278b8383bbb86 /telegram/handlers.go
parent70383bee128b11451211e514200b23f47bf272db (diff)
Don't subscribe to chat updates with no conversations
Diffstat (limited to 'telegram/handlers.go')
-rw-r--r--telegram/handlers.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/telegram/handlers.go b/telegram/handlers.go
index aef8286..2756a2c 100644
--- a/telegram/handlers.go
+++ b/telegram/handlers.go
@@ -155,7 +155,11 @@ func (c *Client) updateNewChat(update *client.UpdateNewChat) {
isChannel = typeSupergroup.IsChannel
}
- if !(isChannel && update.Chat.LastReadInboxMessageId == 0) {
+ // don't subscribe to channel posters
+ if !((isChannel && update.Chat.LastReadInboxMessageId == 0) ||
+ // don't subscribe to chats with no conversation
+ // (manual adding will trigger a subscribe anyway)
+ (update.Chat.LastReadInboxMessageId == 0 && update.Chat.LastReadOutboxMessageId == 0)) {
gateway.SendPresence(
c.xmpp,
c.jid,