diff options
Diffstat (limited to 'telegram/utils.go')
-rw-r--r-- | telegram/utils.go | 13 |
1 files changed, 8 insertions, 5 deletions
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 |