0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-07-05 10:08:36 +02:00

modules/console: Add command to get the hashed room id of entity.

This commit is contained in:
Jason Volk 2018-03-06 00:24:32 -08:00
parent c864a6b446
commit 191c9db5c0

View file

@ -1077,6 +1077,7 @@ console_cmd__exec_file(const string_view &line)
// room
//
static bool console_cmd__room__id(const string_view &line);
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__set(const string_view &line);
@ -1132,6 +1133,9 @@ console_cmd__room(const string_view &line)
case hash("redact"):
return console_cmd__room__redact(args);
case hash("id"):
return console_cmd__room__id(args);
default:
throw bad_command{};
}
@ -1473,6 +1477,26 @@ console_cmd__room__redact(const string_view &line)
return true;
}
bool
console_cmd__room__id(const string_view &id)
{
if(m::has_sigil(id)) switch(m::sigil(id))
{
case m::id::USER:
out << m::user{id}.room_id() << std::endl;
break;
case m::id::NODE:
out << m::node{id}.room_id() << std::endl;
break;
default:
break;
}
return true;
}
//
// fed
//