diff options
Diffstat (limited to 'connector/irc/irc.go')
-rw-r--r-- | connector/irc/irc.go | 14 |
1 files changed, 11 insertions, 3 deletions
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 { |