0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 18:22:50 +01:00

modules/console: Add command to iterate the room::origins sequence.

This commit is contained in:
Jason Volk 2018-03-03 02:39:32 -08:00
parent 90e3b90775
commit 69df7add10

View file

@ -993,6 +993,7 @@ static bool console_cmd__room__redact(const string_view &line);
static bool console_cmd__room__message(const string_view &line); static bool console_cmd__room__message(const string_view &line);
static bool console_cmd__room__set(const string_view &line); 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__get(const string_view &line);
static bool console_cmd__room__origins(const string_view &line);
static bool console_cmd__room__messages(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__members(const string_view &line);
static bool console_cmd__room__count(const string_view &line); static bool console_cmd__room__count(const string_view &line);
@ -1022,6 +1023,9 @@ console_cmd__room(const string_view &line)
case hash("count"): case hash("count"):
return console_cmd__room__count(args); return console_cmd__room__count(args);
case hash("origins"):
return console_cmd__room__origins(args);
case hash("members"): case hash("members"):
return console_cmd__room__members(args); return console_cmd__room__members(args);
@ -1107,6 +1111,33 @@ console_cmd__room__members(const string_view &line)
return true; return true;
} }
bool
console_cmd__room__origins(const string_view &line)
{
const m::room::id room_id
{
token(line, ' ', 0)
};
const m::room room
{
room_id
};
const m::room::origins origins
{
room
};
origins.test([](const string_view &origin)
{
out << origin << std::endl;
return false;
});
return true;
}
bool bool
console_cmd__room__state(const string_view &line) console_cmd__room__state(const string_view &line)
{ {