mirror of
https://github.com/matrix-construct/construct
synced 2024-12-29 08:54:02 +01:00
modules/console: Split room members cmd for full event and just user_id.
This commit is contained in:
parent
db026147b7
commit
78513d7998
1 changed files with 38 additions and 0 deletions
|
@ -3102,6 +3102,44 @@ console_cmd__room__members(opt &out, const string_view &line)
|
||||||
room
|
room
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const m::room::members::closure closure{[&out]
|
||||||
|
(const m::user::id &user_id)
|
||||||
|
{
|
||||||
|
out << user_id << std::endl;
|
||||||
|
}};
|
||||||
|
|
||||||
|
members.for_each(membership, closure);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
console_cmd__room__members__events(opt &out, const string_view &line)
|
||||||
|
{
|
||||||
|
const params param{line, " ",
|
||||||
|
{
|
||||||
|
"room_id", "[membership]"
|
||||||
|
}};
|
||||||
|
|
||||||
|
const auto &room_id
|
||||||
|
{
|
||||||
|
m::room_id(param.at(0))
|
||||||
|
};
|
||||||
|
|
||||||
|
const string_view membership
|
||||||
|
{
|
||||||
|
param[1]
|
||||||
|
};
|
||||||
|
|
||||||
|
const m::room room
|
||||||
|
{
|
||||||
|
room_id
|
||||||
|
};
|
||||||
|
|
||||||
|
const m::room::members members
|
||||||
|
{
|
||||||
|
room
|
||||||
|
};
|
||||||
|
|
||||||
const auto closure{[&out](const m::event &event)
|
const auto closure{[&out](const m::event &event)
|
||||||
{
|
{
|
||||||
out << pretty_oneline(event) << std::endl;
|
out << pretty_oneline(event) << std::endl;
|
||||||
|
|
Loading…
Reference in a new issue