mirror of
https://github.com/matrix-construct/construct
synced 2025-01-15 17:16:49 +01:00
modules/console: Checkin the room state type count command.
This commit is contained in:
parent
6f6234fd38
commit
aecbf3ebd0
1 changed files with 35 additions and 0 deletions
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue