0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-26 02:18:53 +02:00

ircd:Ⓜ️ Add more detailed content information in pretty(event).

This commit is contained in:
Jason Volk 2018-04-22 14:24:48 -07:00
parent a3bcd2dbf3
commit 2325208ecd

View file

@ -286,6 +286,13 @@ ircd::m::pretty(const event &event)
<< std::endl;
}
const json::object &contents{json::get<"content"_>(event)};
if(!contents.empty())
s << std::setw(16) << std::right << "content" << " :"
<< size(contents) << " keys; "
<< size(string_view{contents}) << " bytes."
<< std::endl;
const auto &hashes{json::get<"hashes"_>(event)};
for(const auto &hash : hashes)
{
@ -308,18 +315,6 @@ ircd::m::pretty(const event &event)
s << std::endl;
}
const json::object &contents{json::get<"content"_>(event)};
if(!contents.empty())
{
s << std::setw(16) << std::right << "[content]" << " :"
<< "+ " << size(string_view{contents}) << " bytes :";
for(const auto &content : contents)
s << content.first << ", ";
s << std::endl;
}
const auto &auth_events{json::get<"auth_events"_>(event)};
for(const json::array auth_event : auth_events)
{
@ -359,6 +354,14 @@ ircd::m::pretty(const event &event)
s << std::endl;
}
if(!contents.empty())
for(const json::object::member &content : contents)
s << std::setw(16) << std::right << "[content]" << " :"
<< std::setw(7) << std::left << reflect(json::type(content.second)) << " "
<< std::setw(5) << std::right << size(string_view{content.second}) << " bytes "
<< ':' << content.first
<< std::endl;
resizebuf(s, ret);
return ret;
}