From 7f1dc09d520a7a7abd3c29932e9ee134c00c9acf Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Thu, 5 Jul 2018 15:59:41 -0700 Subject: [PATCH] modules/console: Add room members count cmd. --- modules/console.cc | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/modules/console.cc b/modules/console.cc index c75c86ad7..f4378b992 100644 --- a/modules/console.cc +++ b/modules/console.cc @@ -4343,6 +4343,38 @@ console_cmd__room__members__events(opt &out, const string_view &line) return true; } +bool +console_cmd__room__members__count(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 + }; + + out << members.count(membership) << std::endl; + return true; +} + bool console_cmd__room__members__origin(opt &out, const string_view &line) {