0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-16 15:00:51 +01:00

modules/m_receipt: Additional hook conditions; switch the hooksite; minor cleanup.

This commit is contained in:
Jason Volk 2019-03-28 14:31:24 -07:00
parent 31f1e28c24
commit a889122dcc

View file

@ -34,7 +34,7 @@ _m_receipt_eval
{
handle_edu_m_receipt,
{
{ "_site", "vm.eval" },
{ "_site", "vm.effect" },
{ "type", "m.receipt" },
}
};
@ -46,6 +46,9 @@ handle_edu_m_receipt(const m::event &event,
if(json::get<"room_id"_>(event))
return;
if(my_host(json::get<"origin"_>(event)))
return;
const json::object &content
{
at<"content"_>(event)
@ -144,6 +147,10 @@ try
user_id
};
// This handler only cares about remote users.
if(my(user))
return;
if(!exists(user))
{
log::dwarning
@ -157,7 +164,10 @@ try
return;
}
m::receipt::read(room_id, user_id, event_id, ts);
const auto evid
{
m::receipt::read(room_id, user_id, event_id, ts)
};
}
catch(const std::exception &e)
{
@ -198,8 +208,7 @@ ircd::m::receipt::read(const m::room::id &room_id,
string_view{event_id},
string_view{user_id},
string_view{room_id},
ms,
string_view{evid}
ms
};
return evid;
@ -371,6 +380,9 @@ handle_implicit_receipt(const m::event &event,
m::vm::eval &eval)
try
{
if(!json::get<"event_id"_>(event))
return;
const m::user::id &user_id
{
at<"sender"_>(event)