diff options
author | Bohdan Horbeshko <bodqhrohro@gmail.com> | 2022-07-08 15:43:44 +0300 |
---|---|---|
committer | Bohdan Horbeshko <bodqhrohro@gmail.com> | 2022-07-08 15:43:44 +0300 |
commit | 7ef32096af6017607f70a0b5aa2fbc03925c72d1 (patch) | |
tree | 1c3dfed09b9916110fd259846993c64af0f58de4 /telegram/utils.go | |
parent | 63f12202d0c5d2a570b48d05e62722e0fea54467 (diff) |
Basic room disco info
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 |