0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-15 14:31:11 +01:00

modules/console: Condense room top output.

modules/console: Skip member events on room top.

modules/console: Improve event long info.

modules/console: Add server count to room top.

modules/m_fetch: Minor cleanup.
This commit is contained in:
Jason Volk 2019-07-21 18:51:36 -07:00
parent 6c9dbdbef5
commit 4178f40ee1
2 changed files with 14 additions and 7 deletions

View file

@ -6648,8 +6648,6 @@ console_cmd__event(opt &out, const string_view &line)
const auto refcnt(refs.count()); const auto refcnt(refs.count());
if(refcnt) if(refcnt)
{ {
out << std::endl;
out << "+ REFERENCED BY " << refs.count() << std::endl;
refs.for_each([&out] refs.for_each([&out]
(const m::event::idx &idx, const auto &type) (const m::event::idx &idx, const auto &type)
{ {
@ -6661,6 +6659,8 @@ console_cmd__event(opt &out, const string_view &line)
return true; return true;
}); });
} }
out << std::endl;
out << "+ REFERENCED BY " << refs.count() << std::endl;
return true; return true;
} }
@ -7573,6 +7573,7 @@ console_cmd__room__top(opt &out, const string_view &line)
out << "top depth: " << std::get<int64_t>(top) << std::endl; out << "top depth: " << std::get<int64_t>(top) << std::endl;
out << "top event: " << std::get<m::event::id::buf>(top) << std::endl; out << "top event: " << std::get<m::event::id::buf>(top) << std::endl;
out << "joined: " << m::room::members{room_id}.count("join") << std::endl; out << "joined: " << m::room::members{room_id}.count("join") << std::endl;
out << "servers: " << m::room::origins{room_id}.count() << std::endl;
out << std::endl; out << std::endl;
state.for_each(m::room::state::types{[&out, &state] state.for_each(m::room::state::types{[&out, &state]
@ -7581,16 +7582,18 @@ console_cmd__room__top(opt &out, const string_view &line)
if(!startswith(type, "m.")) if(!startswith(type, "m."))
return true; return true;
if(type == "m.room.member")
return true;
state.for_each(type, m::event::closure{[&out, &type] state.for_each(type, m::event::closure{[&out, &type]
(const m::event &event) (const m::event &event)
{ {
if(json::get<"state_key"_>(event) != "" && type != "m.room.aliases") if(json::get<"state_key"_>(event) != "" && type != "m.room.aliases")
return; return;
out << json::get<"type"_>(event) << ':' << std::endl; for(const auto &[prop, val] : json::get<"content"_>(event))
for(const auto &member : json::get<"content"_>(event)) out << json::get<"type"_>(event)
out << '\t' << member.first << ": " << member.second << std::endl; << ": " << prop << ": " << val << std::endl;
out << std::endl;
}}); }});
return true; return true;

View file

@ -429,7 +429,11 @@ ircd::m::fetch::_heads(const m::feds::opts &opts_)
if(result.eptr) if(result.eptr)
return true; return true;
const json::object &event{result.object["event"]}; const json::object &event
{
result.object["event"]
};
const m::event::prev prev{event}; const m::event::prev prev{event};
for(size_t i(0); i < prev.prev_events_count(); ++i) for(size_t i(0); i < prev.prev_events_count(); ++i)
{ {