5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-12-24 17:15:40 +00:00

Fix loop from webhook by adding matterbridge prop (mattermost). Closes #261

This commit is contained in:
Wim 2017-09-18 23:53:30 +02:00
parent 1a40b0c1e9
commit 47b7fae61b

View File

@ -163,6 +163,9 @@ func (b *Bmattermost) Send(msg config.Message) (string, error) {
matterMessage.UserName = nick
matterMessage.Type = ""
matterMessage.Text = message
matterMessage.Text = message
matterMessage.Props = make(map[string]interface{})
matterMessage.Props["matterbridge"] = true
err := b.mh.Send(matterMessage)
if err != nil {
flog.Info(err)
@ -226,6 +229,10 @@ func (b *Bmattermost) handleMatterClient(mchan chan *MMMessage) {
props := message.Post.Props
if props != nil {
if _, ok := props["matterbridge"].(bool); ok {
flog.Debugf("sent by matterbridge, ignoring")
continue
}
if _, ok := props["override_username"].(string); ok {
message.Username = props["override_username"].(string)
}