0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 18:22:50 +01:00

modules/client/sync/rooms/state: Deal with "invite_state" vs. "state".

This commit is contained in:
Jason Volk 2019-03-03 16:31:43 -08:00
parent e93e460f22
commit 3099997049

View file

@ -11,14 +11,19 @@
namespace ircd::m::sync
{
static bool room_state_polylog_events(data &);
static bool _room_state_polylog(data &);
static bool room_state_polylog(data &);
static bool room_invite_state_polylog(data &);
static bool room_state_linear_events(data &);
static bool _room_state_linear(data &);
static bool room_state_linear(data &);
static bool room_invite_state_linear(data &);
extern const event::keys::include _default_keys;
extern event::fetch::opts _default_fopts;
extern item room_invite_state;
extern item room_state;
}
@ -39,6 +44,14 @@ ircd::m::sync::room_state
room_state_linear
};
decltype(ircd::m::sync::room_invite_state)
ircd::m::sync::room_invite_state
{
"rooms.invite_state",
room_invite_state_polylog,
room_invite_state_linear
};
decltype(ircd::m::sync::_default_keys)
ircd::m::sync::_default_keys
{
@ -61,6 +74,24 @@ ircd::m::sync::_default_fopts
bool
ircd::m::sync::room_state_linear(data &data)
{
if(data.membership == "invite")
return false;
return _room_state_linear(data);
}
bool
ircd::m::sync::room_invite_state_linear(data &data)
{
if(data.membership != "invite")
return false;
return _room_state_linear(data);
}
bool
ircd::m::sync::_room_state_linear(data &data)
{
// if since token is non-zero, any events in the range are
// included in the timeline array and not the state array.
@ -85,6 +116,24 @@ ircd::m::sync::room_state_linear(data &data)
bool
ircd::m::sync::room_state_polylog(data &data)
{
if(data.membership == "invite")
return false;
return _room_state_polylog(data);
}
bool
ircd::m::sync::room_invite_state_polylog(data &data)
{
if(data.membership != "invite")
return false;
return _room_state_polylog(data);
}
bool
ircd::m::sync::_room_state_polylog(data &data)
{
if(!apropos(data, data.room_head))
return false;