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:
parent
d469015e95
commit
1e9b2cad9c
6 changed files with 18 additions and 3 deletions
|
@ -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")
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue