From 80822b7fff85647ad5852b00ec36d046959aed92 Mon Sep 17 00:00:00 2001 From: Wim Date: Sat, 3 Feb 2018 01:11:11 +0100 Subject: Send chat notification if media is too big to be re-uploaded to MediaServer. See #359 --- bridge/rocketchat/rocketchat.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'bridge/rocketchat/rocketchat.go') diff --git a/bridge/rocketchat/rocketchat.go b/bridge/rocketchat/rocketchat.go index 05238539..0164612e 100644 --- a/bridge/rocketchat/rocketchat.go +++ b/bridge/rocketchat/rocketchat.go @@ -2,6 +2,7 @@ package brocketchat import ( "github.com/42wim/matterbridge/bridge/config" + "github.com/42wim/matterbridge/bridge/helper" "github.com/42wim/matterbridge/hook/rockethook" "github.com/42wim/matterbridge/matterhook" log "github.com/Sirupsen/logrus" @@ -57,6 +58,22 @@ func (b *Brocketchat) Send(msg config.Message) (string, error) { return "", nil } flog.Debugf("Receiving %#v", msg) + if msg.Extra != nil { + for _, rmsg := range helper.HandleExtra(&msg, b.General) { + matterMessage := matterhook.OMessage{IconURL: b.Config.IconURL, Channel: rmsg.Channel, UserName: rmsg.Username, + Text: rmsg.Text} + b.mh.Send(matterMessage) + } + if len(msg.Extra["file"]) > 0 { + for _, f := range msg.Extra["file"] { + fi := f.(config.FileInfo) + if fi.URL != "" { + msg.Text += fi.URL + } + } + } + } + matterMessage := matterhook.OMessage{IconURL: b.Config.IconURL} matterMessage.Channel = msg.Channel matterMessage.UserName = msg.Username -- cgit v1.2.3