summaryrefslogtreecommitdiffstats
path: root/bridge/mattermost/mattermost.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2017-09-18 23:53:30 +0200
committerWim <wim@42.be>2017-09-18 23:53:30 +0200
commit47b7fae61be81ddd6089a1cff9763522b3e45bd9 (patch)
treefdd4c91368406c6cf58f574755b347fdc3c1211c /bridge/mattermost/mattermost.go
parent1a40b0c1e9dd9772d760a68f2998b3bcb0f8a413 (diff)
downloadmatterbridge-msglm-47b7fae61be81ddd6089a1cff9763522b3e45bd9.tar.gz
matterbridge-msglm-47b7fae61be81ddd6089a1cff9763522b3e45bd9.tar.bz2
matterbridge-msglm-47b7fae61be81ddd6089a1cff9763522b3e45bd9.zip
Fix loop from webhook by adding matterbridge prop (mattermost). Closes #261
Diffstat (limited to 'bridge/mattermost/mattermost.go')
-rw-r--r--bridge/mattermost/mattermost.go7
1 files changed, 7 insertions, 0 deletions
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)
}