From 7ef32096af6017607f70a0b5aa2fbc03925c72d1 Mon Sep 17 00:00:00 2001 From: Bohdan Horbeshko Date: Fri, 8 Jul 2022 08:43:44 -0400 Subject: Basic room disco info --- telegram/utils.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'telegram') diff --git a/telegram/utils.go b/telegram/utils.go index 7747acb..5244803 100644 --- a/telegram/utils.go +++ b/telegram/utils.go @@ -1075,11 +1075,8 @@ func (c *Client) GetGroupChats() []*client.Chat { if err == nil { for _, id := range chats.ChatIds { chat, _, _ := c.GetContactByID(id, nil) - if chat != nil { - typ := chat.Type.ChatTypeType() - if typ == client.TypeChatTypeBasicGroup { - groupChats = append(groupChats, chat) - } + if chat != nil && c.IsGroup(chat) { + groupChats = append(groupChats, chat) } } } else { @@ -1089,6 +1086,12 @@ func (c *Client) GetGroupChats() []*client.Chat { return groupChats } +// IsGroup determines if a chat is eligible to be represented as MUC +func (c *Client) IsGroup(chat *client.Chat) bool { + typ := chat.Type.ChatTypeType() + return typ == client.TypeChatTypeBasicGroup +} + // subscribe to a Telegram ID func (c *Client) subscribeToID(id int64, chat *client.Chat) { var args []args.V -- cgit v1.2.3