From 3c3fb030bc20bf4ba006baaf0dc1f04c2dbba4b1 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sat, 28 Jan 2023 19:46:43 -0800 Subject: [PATCH] modules/console: Add room msghtml cmd. --- modules/console.cc | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/modules/console.cc b/modules/console.cc index bc88c5454..ec1c8fc97 100644 --- a/modules/console.cc +++ b/modules/console.cc @@ -12071,6 +12071,43 @@ console_cmd__room__message(opt &out, const string_view &line) return true; } +bool +console_cmd__room__msghtml(opt &out, const string_view &line) +{ + const params param{line, " ", + { + "room_id", "user_id" + }}; + + const auto room_id + { + m::room_id(param.at("room_id")) + }; + + const m::user::id sender + { + param.at("user_id") + }; + + const string_view body + { + tokens_after(line, ' ', 1) + }; + + const m::room room + { + room_id + }; + + const auto event_id + { + msghtml(room, sender, body, body, "m.text") + }; + + out << event_id << std::endl; + return true; +} + bool console_cmd__room__join(opt &out, const string_view &line) {