mirror of
https://github.com/matrix-construct/construct
synced 2024-10-01 05:08:59 +02:00
modules/console: Augment room state rebuild present with remote_joined_only option.
This commit is contained in:
parent
a8b3e29cac
commit
87717bc10b
1 changed files with 18 additions and 7 deletions
|
@ -9205,24 +9205,35 @@ console_cmd__room__state__rebuild__present(opt &out, const string_view &line)
|
||||||
|
|
||||||
const auto &room_id
|
const auto &room_id
|
||||||
{
|
{
|
||||||
param.at("room_id") != "*"?
|
param.at("room_id") != "*" && param.at("room_id") != "remote_joined_only"?
|
||||||
m::room_id(param.at(0)):
|
m::room_id(param.at(0)):
|
||||||
"*"_sv
|
param["room_id"]
|
||||||
};
|
};
|
||||||
|
|
||||||
if(room_id == "*")
|
if(room_id == "*" || room_id == "remote_joined_only")
|
||||||
{
|
{
|
||||||
m::rooms::for_each([&out]
|
m::rooms::opts opts;
|
||||||
|
opts.remote_joined_only = room_id == "remote_joined_only";
|
||||||
|
m::rooms::for_each(opts, [&out]
|
||||||
(const m::room::id &room_id)
|
(const m::room::id &room_id)
|
||||||
{
|
{
|
||||||
const m::room room{room_id};
|
const m::room::state state
|
||||||
const m::room::state state{room};
|
{
|
||||||
|
room_id
|
||||||
|
};
|
||||||
|
|
||||||
const size_t count
|
const size_t count
|
||||||
{
|
{
|
||||||
m::room::state::rebuild_present(state)
|
m::room::state::rebuild_present(state)
|
||||||
};
|
};
|
||||||
|
|
||||||
out << "done " << room_id << " " << count << std::endl;
|
log::info
|
||||||
|
{
|
||||||
|
"Rebuild of %s complete with %zu present state events.",
|
||||||
|
string_view{room_id},
|
||||||
|
count,
|
||||||
|
};
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue