diff --git a/bridge/xmpp/xmpp.go b/bridge/xmpp/xmpp.go
index 89a48742..0a9db609 100644
--- a/bridge/xmpp/xmpp.go
+++ b/bridge/xmpp/xmpp.go
@@ -352,24 +352,12 @@ func (b *Bxmpp) handleUploadFile(msg *config.Message) error {
for _, file := range msg.Extra["file"] {
fileInfo := file.(config.FileInfo)
if fileInfo.Comment != "" {
- msg.Text += fileInfo.Comment + ": "
+ msg.Text += fileInfo.Comment
}
if fileInfo.URL != "" {
- msg.Text = fileInfo.URL
if fileInfo.Comment != "" {
- msg.Text = fileInfo.Comment + ": " + fileInfo.URL
urlDesc = fileInfo.Comment
}
- }
- if _, err := b.xc.Send(xmpp.Chat{
- Type: "groupchat",
- Remote: msg.Channel + "@" + b.GetString("Muc"),
- Text: msg.Username + msg.Text,
- }); err != nil {
- return err
- }
-
- if fileInfo.URL != "" {
if _, err := b.xc.SendOOB(xmpp.Chat{
Type: "groupchat",
Remote: msg.Channel + "@" + b.GetString("Muc"),
@@ -379,6 +367,13 @@ func (b *Bxmpp) handleUploadFile(msg *config.Message) error {
b.Log.WithError(err).Warn("Failed to send share URL.")
}
}
+ if _, err := b.xc.Send(xmpp.Chat{
+ Type: "groupchat",
+ Remote: msg.Channel + "@" + b.GetString("Muc"),
+ Text: msg.Username + msg.Text,
+ }); err != nil {
+ return err
+ }
}
return nil
}
diff --git a/vendor/github.com/matterbridge/go-xmpp/xmpp.go b/vendor/github.com/matterbridge/go-xmpp/xmpp.go
index 56b08f5b..ae2a08e5 100644
--- a/vendor/github.com/matterbridge/go-xmpp/xmpp.go
+++ b/vendor/github.com/matterbridge/go-xmpp/xmpp.go
@@ -875,7 +875,7 @@ func (c *Client) Send(chat Chat) (n int, err error) {
return fmt.Fprintf(c.conn, stanza, xmlEscape(chat.Remote), xmlEscape(chat.Type), xmlEscape(chat.Text))
}
-// SendOOB sends OOB data wrapped inside an XMPP message stanza, without actual body.
+// SendOOB sends OOB data wrapped inside an XMPP message stanza, with actual body to trigger inline display for modern XMPP clients
func (c *Client) SendOOB(chat Chat) (n int, err error) {
var thdtext, oobtext string
if chat.Thread != `` {
@@ -888,8 +888,9 @@ func (c *Client) SendOOB(chat Chat) (n int, err error) {
}
oobtext += ``
}
- return fmt.Fprintf(c.conn, ""+oobtext+thdtext+"",
- xmlEscape(chat.Remote), xmlEscape(chat.Type), cnonce())
+ stanza := " "+xmlEscape(chat.Ooburl)+"" + oobtext + thdtext + ""
+
+ return fmt.Fprintf(c.conn, stanza, xmlEscape(chat.Remote), xmlEscape(chat.Type),cnonce())
}
// SendOrg sends the original text without being wrapped in an XMPP message stanza.