mirror of
https://github.com/matrix-construct/construct
synced 2024-10-04 14:48:56 +02:00
modules/console: Add command to get the hashed room id of entity.
This commit is contained in:
parent
c864a6b446
commit
191c9db5c0
1 changed files with 24 additions and 0 deletions
|
@ -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
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue