From ce93d9024ba98d8333f4b74eef347105ad78a89e Mon Sep 17 00:00:00 2001 From: ubq323 Date: Fri, 16 Aug 2024 11:48:39 +0100 Subject: [PATCH] irc: don't drop message body when sending attachment URLs --- bridge/irc/handlers.go | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/bridge/irc/handlers.go b/bridge/irc/handlers.go index cb2cc855..19d1b20f 100644 --- a/bridge/irc/handlers.go +++ b/bridge/irc/handlers.go @@ -50,18 +50,26 @@ func (b *Birc) handleFiles(msg *config.Message) bool { if len(msg.Extra["file"]) == 0 { return false } + + if msg.Text != "" { + b.Local <- config.Message{ + Text: msg.Text, + Username: msg.Username, + Channel: msg.Channel, + Event: msg.Event, + } + } + for _, f := range msg.Extra["file"] { fi := f.(config.FileInfo) + var text = "" if fi.Comment != "" { - msg.Text += fi.Comment + " : " + text += fi.Comment + " : " } if fi.URL != "" { - msg.Text = fi.URL - if fi.Comment != "" { - msg.Text = fi.Comment + " : " + fi.URL - } + text += fi.URL } - b.Local <- config.Message{Text: msg.Text, Username: msg.Username, Channel: msg.Channel, Event: msg.Event} + b.Local <- config.Message{Text: text, Username: msg.Username, Channel: msg.Channel, Event: msg.Event} } return true }