fix multiline tests

This commit is contained in:
Luca Matei Pintilie
2025-11-28 20:30:12 +01:00
committed by mathieui
parent 6993577cbe
commit f2a55c4f27
6 changed files with 11 additions and 17 deletions
+4 -10
View File
@@ -223,7 +223,10 @@ void Bridge::send_channel_message(const Iid& iid, const std::string& body, std::
if (lines.empty())
return ;
if (irc->has_capability("draft/multiline"))
if (irc->has_capability("draft/multiline")
// /me and /mode cannot be multi lined
&& lines[0].substr(0, 5) != "/mode"
&& lines[0].substr(0, 4) != "/me ")
{
std::string uuid;
const auto xmpp_body = this->make_xmpp_body(body);
@@ -277,15 +280,6 @@ void Bridge::send_channel_message(const Iid& iid, const std::string& body, std::
this->xmpp.send_stanza(stanza);
}
};
// MODE can't be multiline. Only check the first line, and discard the rest silently
if (lines[0].substr(0, 5) == "/mode")
{
std::vector<std::string> 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;
}