summaryrefslogtreecommitdiffstats
path: root/bridge
diff options
context:
space:
mode:
authorWim <wim@42.be>2018-04-13 22:01:03 +0200
committerWim <wim@42.be>2018-04-13 22:01:03 +0200
commit68fbed92819f83e282af6394e568446b63158257 (patch)
tree1c241c5e5c1cd4ec692be7ccb9fdd4d077ef43e5 /bridge
parent8bfaa007d5200e0b30b59a3fcccdbed8f39f571c (diff)
downloadmatterbridge-msglm-68fbed92819f83e282af6394e568446b63158257.tar.gz
matterbridge-msglm-68fbed92819f83e282af6394e568446b63158257.tar.bz2
matterbridge-msglm-68fbed92819f83e282af6394e568446b63158257.zip
Make our callbackid more unique. Fixes issue with running multiple matterbridge on the same channel (slack,mattermost)
Diffstat (limited to 'bridge')
-rw-r--r--bridge/mattermost/mattermost.go6
-rw-r--r--bridge/slack/slack.go4
2 files changed, 5 insertions, 5 deletions
diff --git a/bridge/mattermost/mattermost.go b/bridge/mattermost/mattermost.go
index 7a3806ab..42843d00 100644
--- a/bridge/mattermost/mattermost.go
+++ b/bridge/mattermost/mattermost.go
@@ -366,7 +366,7 @@ func (b *Bmattermost) sendWebhook(msg config.Message) (string, error) {
// this sends a message only if we received a config.EVENT_FILE_FAILURE_SIZE
for _, rmsg := range helper.HandleExtra(&msg, b.General) {
matterMessage := matterhook.OMessage{IconURL: b.GetString("IconURL"), Channel: rmsg.Channel, UserName: rmsg.Username, Text: rmsg.Text, Props: make(map[string]interface{})}
- matterMessage.Props["matterbridge"] = true
+ matterMessage.Props["matterbridge_"+b.mc.User.Id] = true
b.mh.Send(matterMessage)
}
@@ -385,7 +385,7 @@ func (b *Bmattermost) sendWebhook(msg config.Message) (string, error) {
if msg.Avatar != "" {
matterMessage.IconURL = msg.Avatar
}
- matterMessage.Props["matterbridge"] = true
+ matterMessage.Props["matterbridge_"+b.mc.User.Id] = true
err := b.mh.Send(matterMessage)
if err != nil {
b.Log.Info(err)
@@ -415,7 +415,7 @@ func (b *Bmattermost) skipMessage(message *matterclient.Message) bool {
// Ignore messages sent from matterbridge
if message.Post.Props != nil {
- if _, ok := message.Post.Props["matterbridge"].(bool); ok {
+ if _, ok := message.Post.Props["matterbridge_"+b.mc.User.Id].(bool); ok {
b.Log.Debugf("sent by matterbridge, ignoring")
return true
}
diff --git a/bridge/slack/slack.go b/bridge/slack/slack.go
index 7706f2bf..7d413337 100644
--- a/bridge/slack/slack.go
+++ b/bridge/slack/slack.go
@@ -177,7 +177,7 @@ func (b *Bslack) Send(msg config.Message) (string, error) {
np.IconURL = msg.Avatar
}
// add a callback ID so we can see we created it
- np.Attachments = append(np.Attachments, slack.Attachment{CallbackID: "matterbridge"})
+ np.Attachments = append(np.Attachments, slack.Attachment{CallbackID: "matterbridge_" + b.si.User.ID})
// add file attachments
np.Attachments = append(np.Attachments, b.createAttach(msg.Extra)...)
// add slack attachments (from another slack bridge)
@@ -644,7 +644,7 @@ func (b *Bslack) skipMessageEvent(ev *slack.MessageEvent) bool {
// skip messages we made ourselves
if len(ev.Attachments) > 0 {
- if ev.Attachments[0].CallbackID == "matterbridge" {
+ if ev.Attachments[0].CallbackID == "matterbridge_"+b.si.User.ID {
return true
}
}