5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-11-29 01:11:35 +00:00

Fix iconurl regression (mattermost,slack,rocketchat). Closes #430

This commit is contained in:
Wim 2018-05-27 22:30:17 +02:00
parent 696c518550
commit 07885f5810
3 changed files with 12 additions and 6 deletions

View File

@ -368,7 +368,8 @@ func (b *Bmattermost) sendWebhook(msg config.Message) (string, error) {
if msg.Extra != nil { if msg.Extra != nil {
// this sends a message only if we received a config.EVENT_FILE_FAILURE_SIZE // this sends a message only if we received a config.EVENT_FILE_FAILURE_SIZE
for _, rmsg := range helper.HandleExtra(&msg, b.General) { 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{})} iconURL := config.GetIconURL(&rmsg, b.GetString("iconurl"))
matterMessage := matterhook.OMessage{IconURL: iconURL, Channel: rmsg.Channel, UserName: rmsg.Username, Text: rmsg.Text, Props: make(map[string]interface{})}
matterMessage.Props["matterbridge_"+b.uuid] = true matterMessage.Props["matterbridge_"+b.uuid] = true
b.mh.Send(matterMessage) b.mh.Send(matterMessage)
} }
@ -384,7 +385,8 @@ func (b *Bmattermost) sendWebhook(msg config.Message) (string, error) {
} }
} }
matterMessage := matterhook.OMessage{IconURL: b.GetString("IconURL"), Channel: msg.Channel, UserName: msg.Username, Text: msg.Text, Props: make(map[string]interface{})} iconURL := config.GetIconURL(&msg, b.GetString("iconurl"))
matterMessage := matterhook.OMessage{IconURL: iconURL, Channel: msg.Channel, UserName: msg.Username, Text: msg.Text, Props: make(map[string]interface{})}
if msg.Avatar != "" { if msg.Avatar != "" {
matterMessage.IconURL = msg.Avatar matterMessage.IconURL = msg.Avatar
} }

View File

@ -53,7 +53,8 @@ func (b *Brocketchat) Send(msg config.Message) (string, error) {
b.Log.Debugf("=> Receiving %#v", msg) b.Log.Debugf("=> Receiving %#v", msg)
if msg.Extra != nil { if msg.Extra != nil {
for _, rmsg := range helper.HandleExtra(&msg, b.General) { for _, rmsg := range helper.HandleExtra(&msg, b.General) {
matterMessage := matterhook.OMessage{IconURL: b.GetString("IconURL"), Channel: rmsg.Channel, UserName: rmsg.Username, Text: rmsg.Text} iconURL := config.GetIconURL(&rmsg, b.GetString("iconurl"))
matterMessage := matterhook.OMessage{IconURL: iconURL, Channel: rmsg.Channel, UserName: rmsg.Username, Text: rmsg.Text}
b.mh.Send(matterMessage) b.mh.Send(matterMessage)
} }
if len(msg.Extra["file"]) > 0 { if len(msg.Extra["file"]) > 0 {
@ -66,7 +67,8 @@ func (b *Brocketchat) Send(msg config.Message) (string, error) {
} }
} }
matterMessage := matterhook.OMessage{IconURL: b.GetString("IconURL")} iconURL := config.GetIconURL(&msg, b.GetString("iconurl"))
matterMessage := matterhook.OMessage{IconURL: iconURL}
matterMessage.Channel = msg.Channel matterMessage.Channel = msg.Channel
matterMessage.UserName = msg.Username matterMessage.UserName = msg.Username
matterMessage.Type = "" matterMessage.Type = ""

View File

@ -610,7 +610,8 @@ func (b *Bslack) sendWebhook(msg config.Message) (string, error) {
if msg.Extra != nil { if msg.Extra != nil {
// this sends a message only if we received a config.EVENT_FILE_FAILURE_SIZE // this sends a message only if we received a config.EVENT_FILE_FAILURE_SIZE
for _, rmsg := range helper.HandleExtra(&msg, b.General) { for _, rmsg := range helper.HandleExtra(&msg, b.General) {
matterMessage := matterhook.OMessage{IconURL: b.GetString("IconURL"), Channel: msg.Channel, UserName: rmsg.Username, Text: rmsg.Text} iconURL := config.GetIconURL(&rmsg, b.GetString("iconurl"))
matterMessage := matterhook.OMessage{IconURL: iconURL, Channel: msg.Channel, UserName: rmsg.Username, Text: rmsg.Text}
b.mh.Send(matterMessage) b.mh.Send(matterMessage)
} }
@ -633,7 +634,8 @@ func (b *Bslack) sendWebhook(msg config.Message) (string, error) {
} }
} }
matterMessage := matterhook.OMessage{IconURL: b.GetString("IconURL"), Attachments: attachs, Channel: msg.Channel, UserName: msg.Username, Text: msg.Text} iconURL := config.GetIconURL(&msg, b.GetString("iconurl"))
matterMessage := matterhook.OMessage{IconURL: iconURL, Attachments: attachs, Channel: msg.Channel, UserName: msg.Username, Text: msg.Text}
if msg.Avatar != "" { if msg.Avatar != "" {
matterMessage.IconURL = msg.Avatar matterMessage.IconURL = msg.Avatar
} }