0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-26 23:44:01 +01:00

ircd:Ⓜ️ Add option to elide content keys for pretty_oneline(event).

This commit is contained in:
Jason Volk 2018-03-14 23:58:34 -07:00
parent be6a5b7767
commit 150831cd83
2 changed files with 10 additions and 3 deletions

View file

@ -27,7 +27,7 @@ namespace ircd::m
void check_size(const event &);
std::string pretty(const event &);
std::string pretty_oneline(const event &);
std::string pretty_oneline(const event &, const bool &content_keys = true);
id::event event_id(const event &, id::event::buf &buf, const const_buffer &hash);
id::event event_id(const event &, id::event::buf &buf);

View file

@ -287,7 +287,8 @@ ircd::m::pretty(const event &event)
}
std::string
ircd::m::pretty_oneline(const event &event)
ircd::m::pretty_oneline(const event &event,
const bool &content_keys)
{
std::string ret;
std::stringstream s;
@ -357,7 +358,13 @@ ircd::m::pretty_oneline(const event &event)
out("membership", json::get<"membership"_>(event));
out("redacts", json::get<"redacts"_>(event));
const json::object &contents{json::get<"content"_>(event)};
const json::object &contents
{
content_keys?
json::get<"content"_>(event):
json::object{}
};
if(!contents.empty())
{
s << "+" << string_view{contents}.size() << " bytes :";