0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-28 00:14:07 +01:00

modules/client/sync: Improve various sync handler conditions.

This commit is contained in:
Jason Volk 2019-02-27 18:24:12 -08:00
parent d469015e95
commit 1e9b2cad9c
6 changed files with 18 additions and 3 deletions

View file

@ -33,6 +33,9 @@ ircd::m::sync::presence
bool
ircd::m::sync::presence_linear(data &data)
{
if(!data.event_idx)
return false;
assert(data.event);
const m::event &event{*data.event};
if(json::get<"type"_>(event) != "ircd.presence")

View file

@ -34,11 +34,11 @@ ircd::m::sync::room_ephemeral_m_receipt_m_read
bool
ircd::m::sync::room_ephemeral_m_receipt_m_read_linear(data &data)
{
assert(data.event);
if(json::get<"type"_>(*data.event) != "m.receipt")
if(data.event_idx)
return false;
if(!my_host(json::get<"origin"_>(*data.event)))
assert(data.event);
if(json::get<"type"_>(*data.event) != "m.receipt")
return false;
_handle_message_receipt(data, *data.event);

View file

@ -32,6 +32,9 @@ ircd::m::sync::room_ephemeral_m_typing
bool
ircd::m::sync::room_ephemeral_m_typing_linear(data &data)
{
if(data.event_idx)
return false;
assert(data.event);
if(json::get<"type"_>(*data.event) != "m.typing")
return false;

View file

@ -62,6 +62,9 @@ ircd::m::sync::_default_fopts
bool
ircd::m::sync::room_state_linear(data &data)
{
if(!data.event_idx)
return false;
assert(data.event);
if(!json::get<"state_key"_>(*data.event))
return false;

View file

@ -50,6 +50,9 @@ ircd::m::sync::default_keys
bool
ircd::m::sync::room_timeline_linear(data &data)
{
if(!data.event_idx)
return false;
assert(data.event);
if(!json::get<"event_id"_>(*data.event))
return false;

View file

@ -34,6 +34,9 @@ ircd::m::sync::room_unread_notifications
bool
ircd::m::sync::room_unread_notifications_linear(data &data)
{
if(!data.event_idx)
return false;
assert(data.event);
if(!json::get<"event_id"_>(*data.event))
return false;