From 351a726ac5f9ca440b0016ae0e1ecbd64c9aaa03 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Tue, 21 Aug 2018 08:39:34 -0700 Subject: [PATCH] modules/console: cmd to iterate through room state type-strings only. --- modules/console.cc | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/modules/console.cc b/modules/console.cc index bbc1c8db7..1c1ad898a 100644 --- a/modules/console.cc +++ b/modules/console.cc @@ -4689,6 +4689,39 @@ console_cmd__room__state(opt &out, const string_view &line) return true; } +bool +console_cmd__room__state__types(opt &out, const string_view &line) +{ + const auto &room_id + { + m::room_id(token(line, ' ', 0)) + }; + + const auto &event_id + { + token(line, ' ', 1, {}) + }; + + const m::room room + { + room_id, event_id + }; + + const m::room::state state + { + room + }; + + state.for_each(m::room::state::types{[&out] + (const string_view &type) + { + out << type << std::endl; + return true; + }}); + + return true; +} + bool console_cmd__room__state__force(opt &out, const string_view &line) {