From fd768a10be36ec31f674fa291fcbe77b78a2855c Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Fri, 21 Feb 2020 18:08:40 +0100 Subject: Mattermost media objects in both ways + user/team profile pictures from MM to Matrix --- connector/irc/irc.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'connector/irc') diff --git a/connector/irc/irc.go b/connector/irc/irc.go index 38aa79d..2ed3923 100644 --- a/connector/irc/irc.go +++ b/connector/irc/irc.go @@ -205,9 +205,17 @@ func (irc *IRC) Send(event *Event) error { return fmt.Errorf("Invalid target") } - if event.Attachements != nil && len(event.Attachements) > 0 { - // TODO find a way to send them using some hosing of some kind - return fmt.Errorf("Attachements not supported on IRC") + 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 IRC") + } else { + irc.conn.Cmd.Message(dest, fmt.Sprintf("%s (%s, %dkb)", + url, at.Mimetype(), at.Size()/1024)) + } + } } if event.Type == EVENT_MESSAGE { -- cgit v1.2.3