mirror of
https://github.com/matrix-construct/construct
synced 2024-12-25 15:04:10 +01:00
modules/m_command: Fix reply to echo event. (related 75589a4794
)
This commit is contained in:
parent
f1f91d63de
commit
c388361041
2 changed files with 22 additions and 7 deletions
|
@ -24,7 +24,8 @@ save_transaction_id(const m::event &,
|
|||
static m::event::id::buf
|
||||
handle_command(client &,
|
||||
const m::resource::request &,
|
||||
const room &);
|
||||
const m::room &,
|
||||
const string_view & = {});
|
||||
|
||||
m::hookfn<m::vm::eval &>
|
||||
save_transaction_id_hookfn
|
||||
|
@ -189,7 +190,7 @@ put__send(client &client,
|
|||
{
|
||||
const auto cmd_event_id
|
||||
{
|
||||
handle_command(client, request, room)
|
||||
handle_command(client, request, room, event_id)
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -205,7 +206,8 @@ put__send(client &client,
|
|||
m::event::id::buf
|
||||
handle_command(client &client,
|
||||
const m::resource::request &request,
|
||||
const room &room)
|
||||
const m::room &room,
|
||||
const string_view &echo_id)
|
||||
{
|
||||
const user::room user_room
|
||||
{
|
||||
|
@ -219,6 +221,7 @@ handle_command(client &client,
|
|||
{ "msgtype", "m.text" },
|
||||
{ "body", request["body"] },
|
||||
{ "room_id", room.room_id },
|
||||
{ "event_id", echo_id },
|
||||
})
|
||||
};
|
||||
|
||||
|
|
|
@ -77,6 +77,11 @@ try
|
|||
unquote(content.at("room_id"))
|
||||
};
|
||||
|
||||
const json::string &event_id
|
||||
{
|
||||
content["event_id"]
|
||||
};
|
||||
|
||||
const json::string &input_
|
||||
{
|
||||
content.at("body")
|
||||
|
@ -138,6 +143,13 @@ try
|
|||
public_response? "m.room.message" : "ircd.cmd.result"
|
||||
};
|
||||
|
||||
const auto &response_event_id
|
||||
{
|
||||
public_response?
|
||||
string_view{event_id}:
|
||||
string_view{event.event_id}
|
||||
};
|
||||
|
||||
const json::value html_val
|
||||
{
|
||||
html, json::STRING
|
||||
|
@ -163,7 +175,7 @@ try
|
|||
{
|
||||
json::stringify(reply_buf, json::members
|
||||
{
|
||||
{ "event_id", event.event_id },
|
||||
{ "event_id", event_id },
|
||||
})
|
||||
};
|
||||
|
||||
|
@ -172,9 +184,9 @@ try
|
|||
{
|
||||
json::stringify(relates_buf, json::members
|
||||
{
|
||||
{ "event_id", event.event_id },
|
||||
{ "rel_type", "ircd.cmd" },
|
||||
{ "m.in_reply_to", in_reply_to },
|
||||
{ "event_id", event_id },
|
||||
{ "rel_type", "ircd.cmd" },
|
||||
{ "m.in_reply_to", in_reply_to },
|
||||
})
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue