diff options
author | Wim <wim@42.be> | 2017-11-24 22:55:24 +0100 |
---|---|---|
committer | Wim <wim@42.be> | 2017-11-24 22:55:24 +0100 |
commit | 7ec95f786d55aab69541cb3065ea2c9b8eaf9c43 (patch) | |
tree | 1ad62ec1669c40ba9a9ad88474df43866d60450e | |
parent | 1efe40add50a76b7a0ad95187f6034cc75845d16 (diff) | |
download | matterbridge-msglm-7ec95f786d55aab69541cb3065ea2c9b8eaf9c43.tar.gz matterbridge-msglm-7ec95f786d55aab69541cb3065ea2c9b8eaf9c43.tar.bz2 matterbridge-msglm-7ec95f786d55aab69541cb3065ea2c9b8eaf9c43.zip |
Use mediaserver urls for irc,gitter and xmpp
-rw-r--r-- | bridge/gitter/gitter.go | 17 | ||||
-rw-r--r-- | bridge/irc/irc.go | 6 | ||||
-rw-r--r-- | bridge/xmpp/xmpp.go | 13 |
3 files changed, 32 insertions, 4 deletions
diff --git a/bridge/gitter/gitter.go b/bridge/gitter/gitter.go index d8f1aa3d..64b6344f 100644 --- a/bridge/gitter/gitter.go +++ b/bridge/gitter/gitter.go @@ -125,6 +125,23 @@ func (b *Bgitter) Send(msg config.Message) (string, error) { } return "", nil } + + if msg.Extra != nil { + if len(msg.Extra["file"]) > 0 { + for _, f := range msg.Extra["file"] { + fi := f.(config.FileInfo) + if fi.URL != "" { + msg.Text = fi.URL + } + _, err := b.c.SendMessage(roomID, msg.Username+msg.Text) + if err != nil { + return "", err + } + } + return "", nil + } + } + resp, err := b.c.SendMessage(roomID, msg.Username+msg.Text) if err != nil { return "", err diff --git a/bridge/irc/irc.go b/bridge/irc/irc.go index f1ed5bd8..2d56bbc6 100644 --- a/bridge/irc/irc.go +++ b/bridge/irc/irc.go @@ -184,13 +184,11 @@ func (b *Birc) Send(msg config.Message) (string, error) { fi := f.(config.FileInfo) if fi.URL != "" { msg.Text = fi.URL - b.Local <- config.Message{Text: msg.Text, Username: msg.Username, Channel: msg.Channel, Event: msg.Event} - } else { - b.Local <- config.Message{Text: msg.Text, Username: msg.Username, Channel: msg.Channel, Event: msg.Event} } + b.Local <- config.Message{Text: msg.Text, Username: msg.Username, Channel: msg.Channel, Event: msg.Event} } + return "", nil } - return "", nil } for _, text := range strings.Split(msg.Text, "\n") { diff --git a/bridge/xmpp/xmpp.go b/bridge/xmpp/xmpp.go index 6999e801..b5429b1f 100644 --- a/bridge/xmpp/xmpp.go +++ b/bridge/xmpp/xmpp.go @@ -85,6 +85,19 @@ func (b *Bxmpp) Send(msg config.Message) (string, error) { return "", nil } flog.Debugf("Receiving %#v", msg) + if msg.Extra != nil { + if len(msg.Extra["file"]) > 0 { + for _, f := range msg.Extra["file"] { + fi := f.(config.FileInfo) + if fi.URL != "" { + msg.Text = fi.URL + } + b.xc.Send(xmpp.Chat{Type: "groupchat", Remote: msg.Channel + "@" + b.Config.Muc, Text: msg.Username + msg.Text}) + } + return "", nil + } + } + b.xc.Send(xmpp.Chat{Type: "groupchat", Remote: msg.Channel + "@" + b.Config.Muc, Text: msg.Username + msg.Text}) return "", nil } |