From 6993577cbe7260690c68a7fe2119dd76b5ea13a2 Mon Sep 17 00:00:00 2001 From: Luca Matei Pintilie Date: Sun, 3 Aug 2025 13:53:47 +0200 Subject: [PATCH] fix mode tests --- src/bridge/bridge.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/bridge/bridge.cpp b/src/bridge/bridge.cpp index 990055b..df32551 100644 --- a/src/bridge/bridge.cpp +++ b/src/bridge/bridge.cpp @@ -258,11 +258,11 @@ void Bridge::send_channel_message(const Iid& iid, const std::string& body, std:: { if (first) { - messages.push_back(IrcMessage({}, std::move(std::string()), "PRIVMSG", {iid.get_local(), privmsg})); + messages.push_back(IrcMessage({}, std::string(), "PRIVMSG", {iid.get_local(), privmsg})); first = false; } else - messages.push_back(IrcMessage({{"draft/multiline-concat", {}}}, std::move(std::string()), "PRIVMSG", {iid.get_local(), privmsg})); + messages.push_back(IrcMessage({{"draft/multiline-concat", {}}}, std::string(), "PRIVMSG", {iid.get_local(), privmsg})); } } @@ -278,6 +278,14 @@ void Bridge::send_channel_message(const Iid& iid, const std::string& body, std:: } }; + // MODE can't be multiline. Only check the first line, and discard the rest silently + if (lines[0].substr(0, 5) == "/mode") + { + std::vector args = utils::split(body.substr(5), ' ', false); + irc->send_mode_command(iid.get_local(), args); + return; // We do not want to send that back to the + // XMPP user, that’s not a textual message. + } irc->send_batch(uuid, "draft/multiline", {iid.get_local()}, messages, std::move(mirror_to_all_resources)); return; }