From eb18ae9daf40572d489d0efb77eb62c0da4f494b Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Mon, 21 Dec 2020 10:23:41 -0800 Subject: [PATCH] ircd::m: Add argument to toggle sigs in m::essential(). --- include/ircd/m/event/event.h | 2 +- matrix/event.cc | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/include/ircd/m/event/event.h b/include/ircd/m/event/event.h index a0b826e19..824070ca1 100644 --- a/include/ircd/m/event/event.h +++ b/include/ircd/m/event/event.h @@ -43,7 +43,7 @@ namespace ircd::m json::object hashes(const mutable_buffer &, const event &); event signatures(const mutable_buffer &, const m::event &, const string_view &origin); event signatures(const mutable_buffer &, const m::event &); - event essential(event, const mutable_buffer &content); + event essential(event, const mutable_buffer &content, const bool &sigs = false); bool verify_hash(const event &, const sha256::buf &); bool verify_hash(const event &); diff --git a/matrix/event.cc b/matrix/event.cc index 93bcef251..7a06b28a4 100644 --- a/matrix/event.cc +++ b/matrix/event.cc @@ -778,7 +778,8 @@ catch(const json::not_found &e) ircd::m::event ircd::m::essential(m::event event, - const mutable_buffer &contentbuf) + const mutable_buffer &contentbuf. + const bool &sigs) try { const auto &type @@ -902,7 +903,9 @@ try content = "{}"_sv; } - json::get<"signatures"_>(event) = {}; + if(likely(!sigs)) + json::get<"signatures"_>(event) = {}; + return event; } catch(const json::not_found &e)