summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWim <wim@42.be>2018-10-27 13:20:40 +0200
committerWim <wim@42.be>2018-10-27 13:20:40 +0200
commit74e33b0a51f6d8b5cebd355ac3dd0e825e2c83a7 (patch)
treed7186f420014256c7fe054d76fceef55980fdbd2
parent107969c09a044cbce185a50a63cf58e0281eafc3 (diff)
downloadmatterbridge-msglm-74e33b0a51f6d8b5cebd355ac3dd0e825e2c83a7.tar.gz
matterbridge-msglm-74e33b0a51f6d8b5cebd355ac3dd0e825e2c83a7.tar.bz2
matterbridge-msglm-74e33b0a51f6d8b5cebd355ac3dd0e825e2c83a7.zip
Update channels when a new group is created (mattermost)
-rw-r--r--matterclient/matterclient.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/matterclient/matterclient.go b/matterclient/matterclient.go
index 6ea99507..86eb1bea 100644
--- a/matterclient/matterclient.go
+++ b/matterclient/matterclient.go
@@ -334,6 +334,8 @@ 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)
@@ -431,6 +433,10 @@ 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
}
}
@@ -438,6 +444,10 @@ 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
}
}