From c9e847cf58c3e672039884c898ca49e442023516 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Fri, 8 Jun 2018 20:34:00 -0700 Subject: [PATCH] modules/console: Add auth events to fed head cmd. --- modules/console.cc | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/modules/console.cc b/modules/console.cc index be253203d..7b615892e 100644 --- a/modules/console.cc +++ b/modules/console.cc @@ -6087,15 +6087,44 @@ console_cmd__fed__head(opt &out, const string_view &line) request.in.content }; - const json::array prev_events + out << "DEPTH " + << proto.get({"event", "depth"}) + << std::endl; + + const json::array &prev_events { - proto.at({"event", "prev_events"}) + proto.get({"event", "prev_events"}) }; for(const json::array &prev_event : prev_events) { - const string_view &id{prev_event.at(0)}; - out << id << " :" << string_view{prev_event.at(1)} << std::endl; + const m::event::id &id + { + unquote(prev_event.at(0)) + }; + + out << "PREV " + << id << " " + << string_view{prev_event.at(1)} + << std::endl; + } + + const json::array &auth_events + { + proto.get({"event", "auth_events"}) + }; + + for(const json::array &auth_event : auth_events) + { + const m::event::id &id + { + unquote(auth_event.at(0)) + }; + + out << "AUTH " + << id << " " + << string_view{auth_event.at(1)} + << std::endl; } return true;