From 47b7fae61be81ddd6089a1cff9763522b3e45bd9 Mon Sep 17 00:00:00 2001 From: Wim Date: Mon, 18 Sep 2017 23:53:30 +0200 Subject: Fix loop from webhook by adding matterbridge prop (mattermost). Closes #261 --- bridge/mattermost/mattermost.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bridge/mattermost/mattermost.go b/bridge/mattermost/mattermost.go index f9e350e8..bedd07a8 100644 --- a/bridge/mattermost/mattermost.go +++ b/bridge/mattermost/mattermost.go @@ -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) } -- cgit v1.2.3