mirror of
https://github.com/matrix-construct/construct
synced 2025-01-14 16:46:50 +01:00
modules/client/sync/rooms/account_data: Improve polylog sync handler.
This commit is contained in:
parent
58a98806e9
commit
b6fe591142
1 changed files with 20 additions and 15 deletions
|
@ -53,28 +53,33 @@ ircd::m::sync::room_account_data_polylog_events(data &data)
|
|||
};
|
||||
|
||||
assert(data.room);
|
||||
char typebuf[288]; //TODO: room_account_data_typebuf_size
|
||||
char typebuf[m::user::room_account_data::typebuf_size];
|
||||
const auto type
|
||||
{
|
||||
m::user::room_account_data::_type(typebuf, data.room->room_id)
|
||||
};
|
||||
|
||||
static const m::event::fetch::opts &fopts
|
||||
{
|
||||
m::event::keys::include {"event_id", "state_key", "content"}
|
||||
};
|
||||
|
||||
const m::room::state state
|
||||
{
|
||||
data.user_room, &fopts
|
||||
};
|
||||
|
||||
bool ret{false};
|
||||
state.for_each(type, [&data, &ret]
|
||||
(const m::event &event)
|
||||
data.user_state.for_each(type, [&data, &ret]
|
||||
(const m::event::idx &event_idx)
|
||||
{
|
||||
if(apropos(data, event))
|
||||
ret |= room_account_data_polylog_events_event(data, event);
|
||||
if(!apropos(data, event_idx))
|
||||
return;
|
||||
|
||||
static const event::fetch::opts fopts
|
||||
{
|
||||
event::keys::include {"state_key", "content"}
|
||||
};
|
||||
|
||||
const m::event::fetch event
|
||||
{
|
||||
event_idx, std::nothrow, fopts
|
||||
};
|
||||
|
||||
if(!event.valid)
|
||||
return;
|
||||
|
||||
ret |= room_account_data_polylog_events_event(data, event);
|
||||
});
|
||||
|
||||
return ret;
|
||||
|
|
Loading…
Reference in a new issue