0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-07-04 09:38:37 +02:00

modules/console: Checkin the room state type count command.

This commit is contained in:
Jason Volk 2018-02-27 02:36:08 -08:00
parent 6f6234fd38
commit aecbf3ebd0

View file

@ -941,6 +941,7 @@ static bool console_cmd__room__set(const string_view &line);
static bool console_cmd__room__get(const string_view &line);
static bool console_cmd__room__messages(const string_view &line);
static bool console_cmd__room__members(const string_view &line);
static bool console_cmd__room__count(const string_view &line);
static bool console_cmd__room__state(const string_view &line);
static bool console_cmd__room__depth(const string_view &line);
static bool console_cmd__room__head(const string_view &line);
@ -964,6 +965,9 @@ console_cmd__room(const string_view &line)
case hash("state"):
return console_cmd__room__state(args);
case hash("count"):
return console_cmd__room__count(args);
case hash("members"):
return console_cmd__room__members(args);
@ -1075,6 +1079,37 @@ console_cmd__room__state(const string_view &line)
return true;
}
bool
console_cmd__room__count(const string_view &line)
{
const m::room::id room_id
{
token(line, ' ', 0)
};
const string_view &type
{
token_count(line, ' ') > 1? token(line, ' ', 1) : string_view{}
};
const m::room room
{
room_id
};
const m::room::state state
{
room
};
if(type)
out << state.count(type) << std::endl;
else
out << state.count() << std::endl;
return true;
}
bool
console_cmd__room__messages(const string_view &line)
{