Thumbnail

rani/matterbridge.git

Clone URL: https://git.buni.party/rani/matterbridge.git

commit 5d13cfa1ca37e5f01a5957a9872bffdf8e4370a3 Author: Wim <wim@42.be> Date: Sat Oct 27 13:20:40 2018 +0000 Update channels when a new group is created (mattermost) diff --git a/matterclient/matterclient.go b/matterclient/matterclient.go index 6ea9950..86eb1be 100644 --- a/matterclient/matterclient.go +++ b/matterclient/matterclient.go @@ -3346 +3348 @@ func (m *MMClient) parseMessage(rmsg *Message) {   if _, ok := user["id"].(string); ok {   m.UpdateUser(user["id"].(string))   } + case "group_added": + m.UpdateChannels()   /*   case model.ACTION_USER_REMOVED:   m.handleWsActionUserRemoved(&rmsg) @@ -4316 +43310 @@ func (m *MMClient) GetChannelName(channelId string) string {   if t.Channels != nil {   for _, channel := range t.Channels {   if channel.Id == channelId { + if channel.Type == model.CHANNEL_GROUP { + res := strings.Replace(channel.DisplayName, ",", "_", -1) + return strings.Replace(res, " ", "", -1) + }   return channel.Name   }   } @@ -4386 +44410 @@ func (m *MMClient) GetChannelName(channelId string) string {   if t.MoreChannels != nil {   for _, channel := range t.MoreChannels {   if channel.Id == channelId { + if channel.Type == model.CHANNEL_GROUP { + res := strings.Replace(channel.DisplayName, ",", "_", -1) + return strings.Replace(res, " ", "", -1) + }   return channel.Name   }   }