From 23f2a85301f2ee5af867fa774a406cf308733714 Mon Sep 17 00:00:00 2001 From: bodqhrohro Date: Fri, 10 Jan 2020 11:13:25 +0200 Subject: [PATCH] Don't subscribe to chat updates with no conversations --- telegram/handlers.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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,