Thumbnail

rani/matterbridge.git

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

commit 785a122508c569114ccfb70d61c8540c28715b35 Author: rani <clagv.randomgames@gmail.com> Date: Mon Mar 16 14:47:13 2026 +0000 strip nested replies diff --git a/scripts/outmessage.tengo b/scripts/outmessage.tengo index 9a740f4..8bea57d 100644 --- a/scripts/outmessage.tengo +++ b/scripts/outmessage.tengo @@ -217 +219 @@ doQuote_ := func(reply, nick, ctx) { return prefix + nick + "\n> " + ctx + "\n" + reply - } else if outProtocol == "irc" || outProtocol == "telegram" { + } else if outProtocol == "irc" || + outProtocol == "telegram" || + outProtocol == "matrix" { ctx = text.join(text.split(ctx, "\n"), " ") return reply + " (in reply to " + nick + ": " + ctx + ")" } else { @@ -296 +3115 @@ doQuote_ := func(reply, nick, ctx) { }  }   +stripQuote := func(ctx) { + // > ↪ NICK + // > ... + // > ... + // ctx + re := text.re_compile(`(?m)^> (?:-# )?↪ .+\n(?:> .*\n)+(.*)`) + return re.replace(ctx, "$1") +} +  // match $1 must be the reply  // match $2 must be the nick  // match $3 must be the context @@ -369 +4710 @@ doQuote := func(...reStrs) { for reStr in reStrs { re := text.re_compile(reStr) if re.match(msgText) { - reply := re.replace(msgText, "$1") - nick := re.replace(msgText, "$2") - ctx := re.replace(msgText, "$3") + reply := re.replace(msgText, "$1") + nick := re.replace(msgText, "$2") + ctx := re.replace(msgText, "$3") + ctx = stripQuote(ctx) msgText = doQuote_(reply, nick, ctx) break }