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

ircd:Ⓜ️ Complete the room state tuple buffer constructor.

This commit is contained in:
Jason Volk 2018-05-18 00:24:25 -07:00
parent 0839d929c8
commit 997da91477

View file

@ -1582,9 +1582,32 @@ const
// //
ircd::m::room::state::tuple::tuple(const m::room &room, ircd::m::room::state::tuple::tuple(const m::room &room,
const mutable_buffer &buf) const mutable_buffer &buf_)
{ {
const m::room::state state
{
room
};
window_buffer buf{buf_};
json::for_each(*this, [&state, &buf]
(const string_view &type, auto &event)
{
state.get(std::nothrow, type, "", [&buf, &event]
(const event::idx &event_idx)
{
buf([&event, &event_idx]
(const mutable_buffer &buf)
{
event = m::event
{
event_idx, buf
};
return serialized(event);
});
});
});
} }
ircd::m::room::state::tuple::tuple(const json::array &pdus) ircd::m::room::state::tuple::tuple(const json::array &pdus)