aboutsummaryrefslogtreecommitdiff
path: root/connector/xmpp
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2020-02-21 18:08:40 +0100
committerAlex Auvolat <alex@adnab.me>2020-02-21 18:08:40 +0100
commitfd768a10be36ec31f674fa291fcbe77b78a2855c (patch)
treebb9e736bfc9425e1ce5ee22379e8d46470af4d18 /connector/xmpp
parentddd5936fb1f92432123a9a30d1d3a1fa644a4f8e (diff)
downloadeasybridge-fd768a10be36ec31f674fa291fcbe77b78a2855c.tar.gz
easybridge-fd768a10be36ec31f674fa291fcbe77b78a2855c.zip
Mattermost media objects in both ways + user/team profile pictures from MM to Matrix
Diffstat (limited to 'connector/xmpp')
-rw-r--r--connector/xmpp/xmpp.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/connector/xmpp/xmpp.go b/connector/xmpp/xmpp.go
index b18e670..02d1a96 100644
--- a/connector/xmpp/xmpp.go
+++ b/connector/xmpp/xmpp.go
@@ -308,6 +308,19 @@ func (xm *XMPP) Leave(roomId RoomID) {
}
func (xm *XMPP) Send(event *Event) error {
+ if event.Attachments != nil && len(event.Attachments) > 0 {
+ for _, at := range event.Attachments {
+ url := at.URL()
+ if url == "" {
+ // TODO find a way to send them using some hosing of some kind
+ return fmt.Errorf("Attachment without URL sent to XMPP")
+ } else {
+ event.Text += fmt.Sprintf("\n%s (%s, %dkb)",
+ url, at.Mimetype(), at.Size()/1024)
+ }
+ }
+ }
+
fmt.Printf("xm *XMPP Send %#v\n", event)
if len(event.Recipient) > 0 {
_, err := xm.conn.Send(gxmpp.Chat{