From 997da91477da7190a52a44b90e76e847bb4d706a Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Fri, 18 May 2018 00:24:25 -0700 Subject: [PATCH] ircd::m: Complete the room state tuple buffer constructor. --- ircd/m/room.cc | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/ircd/m/room.cc b/ircd/m/room.cc index 37d5cd503..aba0b420c 100644 --- a/ircd/m/room.cc +++ b/ircd/m/room.cc @@ -1582,9 +1582,32 @@ const // 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)