mirror of
https://github.com/matrix-construct/construct
synced 2024-11-25 08:12:37 +01:00
modules/console: Add console cmd to iterate public rooms via interface.
This commit is contained in:
parent
72bfd645da
commit
2174a66ea9
1 changed files with 28 additions and 0 deletions
|
@ -5184,6 +5184,34 @@ console_cmd__rooms(opt &out, const string_view &line)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
console_cmd__rooms__public(opt &out, const string_view &line)
|
||||
{
|
||||
const params param{line, " ",
|
||||
{
|
||||
"server|room_id_lb", "limit"
|
||||
}};
|
||||
|
||||
const string_view &key
|
||||
{
|
||||
param.at("server|room_id_lb", string_view{})
|
||||
};
|
||||
|
||||
auto limit
|
||||
{
|
||||
param.at("limit", 32L)
|
||||
};
|
||||
|
||||
m::rooms::for_each_public(key, [&limit, &out]
|
||||
(const m::room::id &room_id) -> bool
|
||||
{
|
||||
out << room_id << std::endl;
|
||||
return --limit > 0;
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
console_cmd__rooms__fetch(opt &out, const string_view &line)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue