Thumbnail

rani/matterbridge.git

Clone URL: https://git.buni.party/rani/matterbridge.git

commit 5dcf4c97eca6dfbce93e645c3a4c759c6981a576 Author: rani <clagv.randomgames@gmail.com> Date: Sat Apr 18 18:13:06 2026 +0000 Fix: issues with multiline replies; strip newlines in text-based protocols diff --git a/scripts/inmessage.tengo b/scripts/inmessage.tengo index 27e4aa7..e9aec6c 100644 --- a/scripts/inmessage.tengo +++ b/scripts/inmessage.tengo @@ -177 +177 @@ doQuote_ := func(reply, nick, ctx) {  stripQuote := func(ctx) { re := text.re_compile(`(?m)^> (?:-# )?↪ .+\n(?:> .*\n)+(.*)`) if re.match(ctx) { return re.replace(ctx, "$1") } - re = text.re_compile(`(?ms)^(.*?) \(in reply to .*?: .*\)$`) + re = text.re_compile(`(?s)^(.*?) \(in reply to .*?: .*\)$`) if re.match(ctx) { return re.replace(ctx, "$1") } return ctx  } @@ -3816 +3816 @@ doQuote := func(...reStrs) {    if msgText != "" { if msgProtocol == "discord" { - doQuote(`(?ms)(.*?) \(in reply to (.*?): (.*?)\)$`) + doQuote(`(?s)(.*?) \(in reply to (.*?): (.*?)\)$`) } else if msgProtocol == "xmpp" { doQuote( - `(?ms)(.*?) \(in reply to (.*?) \[b]: (.*?)\)$`, - `(?ms)(.*?) \(in reply to (.*?): (.*?)\)$` + `(?s)(.*?) \(in reply to (.*?) \[b]: (.*?)\)$`, + `(?s)(.*?) \(in reply to (.*?): (.*?)\)$` ) } else if msgProtocol == "telegram" { doQuote( - `(?ms)(.*?) \(in reply to lulbridge: <([^>]+)> (.*?)\)$`, - `(?ms)(.*?) \(in reply to (.*?): (.*?)\)$` + `(?s)(.*?) \(in reply to lulbridge: <([^>]+)> (.*?)\)$`, + `(?s)(.*?) \(in reply to (.*?): (.*?)\)$` ) }  } diff --git a/scripts/outmessage.tengo b/scripts/outmessage.tengo index 30b5dd4..8efeecd 100644 --- a/scripts/outmessage.tengo +++ b/scripts/outmessage.tengo @@ -227 +228 @@ doQuote_ := func(reply, nick, ctx) { "\n> " + ctx + "\n" + reply } else { - return msgText + ctx = text.join(text.split(ctx, "\n"), " ") + return reply + " (in reply to " + nick + ": " + ctx + ")" }  }   @@ -604 +614 @@ if (inProtocol == "discord" && outProtocol != "discord") {  }    // format replies from all protocols to all protocols -doQuote(`(?ms)(.*?) \(in reply to (.*?): (.*?)\)$`) +doQuote(`(?s)(.*?) \(in reply to (.*?): (.*?)\)$`)