From bb84740517a6d0434b551783a2104f17016096cf Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Wed, 22 Feb 2023 10:35:33 -0800 Subject: [PATCH] ircd::m::event::append: Move prev_content to unsigned (since v1.2 "no known server impl...") --- matrix/event_append.cc | 44 +++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/matrix/event_append.cc b/matrix/event_append.cc index 50858b4db..21bfccc00 100644 --- a/matrix/event_append.cc +++ b/matrix/event_append.cc @@ -218,6 +218,18 @@ ircd::m::event::append::append(json::stack::object &object, 0UL }; + const bool query_prev_state + { + opts.query_prev_state && has_event_idx && is_state + }; + + const auto prev_state_idx + { + query_prev_state? + room::state::prev(*opts.event_idx): + 0UL + }; + #if defined(RB_DEBUG) && 0 if(!has_client_txnid && !txnid_idx && sender_is_user && opts.query_txnid) log::dwarning @@ -235,28 +247,6 @@ ircd::m::event::append::append(json::stack::object &object, object, "event_id", event.event_id }; - const bool query_prev_state - { - has_event_idx && opts.query_prev_state && is_state - }; - - if(query_prev_state) - { - const auto prev_idx - { - room::state::prev(*opts.event_idx) - }; - - m::get(std::nothrow, prev_idx, "content", [&object] - (const json::object &content) - { - json::stack::member - { - object, "prev_content", content - }; - }); - } - // Get the list of properties to send to the client so we can strip // the remaining and save b/w // TODO: m::filter @@ -340,6 +330,16 @@ ircd::m::event::append::append(json::stack::object &object, }; }); + if(prev_state_idx) + m::get(std::nothrow, prev_state_idx, "content", [&unsigned_] + (const json::object &content) + { + json::stack::member + { + unsigned_, "prev_content", content + }; + }); + if(unlikely(event_append_info)) log::info {