From 7ecf7ecb04e478a08d7f085209fbb34c61f04d5b Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Fri, 8 Feb 2019 03:19:18 -0800 Subject: [PATCH] modules/console: Add event auth cmd suite. --- modules/console.cc | 52 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/modules/console.cc b/modules/console.cc index f2d407193..cc714dde8 100644 --- a/modules/console.cc +++ b/modules/console.cc @@ -5873,6 +5873,58 @@ console_cmd__event__refs__rebuild(opt &out, const string_view &line) return true; } +bool +console_cmd__event__auth(opt &out, const string_view &line) +{ + const params param{line, " ", + { + "event_id" + }}; + + const m::event::id &event_id + { + param.at("event_id") + }; + + const m::event::auth auth + { + index(event_id) + }; + + auth.for_each([&out](const m::event::idx &idx) + { + const m::event::fetch event + { + idx, std::nothrow + }; + + if(!event.valid) + return true; + + out << idx + << " " << pretty_oneline(event) + << std::endl; + + return true; + }); + + return true; +} + +bool +console_cmd__event__auth__rebuild(opt &out, const string_view &line) +{ + using prototype = void (); + static mods::import rebuild + { + "m_event", "event_auth__rebuild" + }; + + rebuild(); + out << "done" << std::endl; + return true; +} + // // state //