0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-27 07:54:05 +01:00

modules/console: Add auth events to fed head cmd.

This commit is contained in:
Jason Volk 2018-06-08 20:34:00 -07:00
parent 1c4e8564b7
commit c9e847cf58

View file

@ -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;