2
0
mirror of https://github.com/42wim/matterbridge synced 2024-11-03 15:40:24 +00:00

Fix panic by using matterclient calls in the right place. Related to cb7278eb (mattermost). Closes #491

This commit is contained in:
Wim 2018-08-30 23:04:50 +02:00
parent 52dbd702ad
commit 330ddb6a30

View File

@ -185,9 +185,6 @@ func (b *Bmattermost) handleMatter() {
for message := range messages {
message.Avatar = helper.GetAvatar(b.avatarMap, message.UserID, b.General)
message.Account = b.Account
if nick := b.mc.GetNickName(message.UserID); nick != "" {
message.Username = nick
}
message.Text, ok = b.replaceAction(message.Text)
if ok {
message.Event = config.EVENT_USER_ACTION
@ -256,6 +253,11 @@ func (b *Bmattermost) handleMatterClient(messages chan *config.Message) {
}
}
}
// Use nickname instead of username if defined
if nick := b.mc.GetNickName(rmsg.UserID); nick != "" {
rmsg.Username = nick
}
messages <- rmsg
}
}