From 1a0d297a09627fa3d95b68b262982f784f721aff Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sat, 22 Sep 2018 17:30:58 -0700 Subject: [PATCH] modules/console: Add a wildcard to rebuild present state of all rooms. --- modules/console.cc | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/modules/console.cc b/modules/console.cc index c09fe0e8f..8d3f114b8 100644 --- a/modules/console.cc +++ b/modules/console.cc @@ -5581,12 +5581,9 @@ console_cmd__room__state__rebuild__present(opt &out, const string_view &line) const auto &room_id { - m::room_id(param.at(0)) - }; - - const m::room room - { - room_id + param.at("room_id") != "*"? + m::room_id(param.at(0)): + "*"_sv }; using prototype = size_t (const m::room &); @@ -5595,12 +5592,28 @@ console_cmd__room__state__rebuild__present(opt &out, const string_view &line) "m_room", "state__rebuild_present" }; + if(room_id == "*") + { + m::rooms::for_each(m::room::id::closure{[&out] + (const m::room::id &room_id) + { + const size_t count + { + state__rebuild_present(m::room{room_id}) + }; + + out << "done " << room_id << " " << count << std::endl; + }}); + + return true; + } + const size_t count { - state__rebuild_present(room) + state__rebuild_present(m::room{room_id}) }; - out << "done " << count << std::endl; + out << "done " << room_id << " " << count << std::endl; return true; }