summaryrefslogtreecommitdiffstats
path: root/bridge/rocketchat/rocketchat.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2018-02-03 01:11:11 +0100
committerWim <wim@42.be>2018-02-03 01:11:11 +0100
commit80822b7fff85647ad5852b00ec36d046959aed92 (patch)
treef3f15769f5b75b53f97c3bedf1bbf6a1f9a909c8 /bridge/rocketchat/rocketchat.go
parent78f1011f529981bab58556d9847488db04d00388 (diff)
downloadmatterbridge-msglm-80822b7fff85647ad5852b00ec36d046959aed92.tar.gz
matterbridge-msglm-80822b7fff85647ad5852b00ec36d046959aed92.tar.bz2
matterbridge-msglm-80822b7fff85647ad5852b00ec36d046959aed92.zip
Send chat notification if media is too big to be re-uploaded to MediaServer. See #359
Diffstat (limited to 'bridge/rocketchat/rocketchat.go')
-rw-r--r--bridge/rocketchat/rocketchat.go17
1 files changed, 17 insertions, 0 deletions
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