mirror of
https://github.com/matrix-construct/construct
synced 2024-11-25 08:12:37 +01:00
modules/console: Add type selection to room state cmd.
This commit is contained in:
parent
cf783d2729
commit
04cb15cc79
1 changed files with 13 additions and 3 deletions
|
@ -5493,14 +5493,19 @@ console_cmd__room__state(opt &out, const string_view &line)
|
||||||
m::room_id(token(line, ' ', 0))
|
m::room_id(token(line, ' ', 0))
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto &event_id
|
const auto &event_id_or_type
|
||||||
{
|
{
|
||||||
token(line, ' ', 1, {})
|
token(line, ' ', 1, {})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const auto is_event_id
|
||||||
|
{
|
||||||
|
m::has_sigil(event_id_or_type) && valid(m::id::EVENT, event_id_or_type)
|
||||||
|
};
|
||||||
|
|
||||||
const m::room room
|
const m::room room
|
||||||
{
|
{
|
||||||
room_id, event_id
|
room_id, is_event_id? event_id_or_type : string_view{}
|
||||||
};
|
};
|
||||||
|
|
||||||
const m::room::state state
|
const m::room::state state
|
||||||
|
@ -5508,7 +5513,12 @@ console_cmd__room__state(opt &out, const string_view &line)
|
||||||
room
|
room
|
||||||
};
|
};
|
||||||
|
|
||||||
state.for_each([&out](const m::event &event)
|
const string_view &type
|
||||||
|
{
|
||||||
|
!is_event_id? event_id_or_type : string_view{}
|
||||||
|
};
|
||||||
|
|
||||||
|
state.for_each(type, [&out](const m::event &event)
|
||||||
{
|
{
|
||||||
out << pretty_oneline(event) << std::endl;
|
out << pretty_oneline(event) << std::endl;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue