mirror of
https://github.com/matrix-construct/construct
synced 2024-07-05 10:08:36 +02:00
modules/console: Add manual room join w/ injection placement event_id.
This commit is contained in:
parent
ff1fe4284d
commit
ce715f62c7
|
@ -1645,6 +1645,67 @@ console_cmd__room__redact(opt &out, const string_view &line)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
console_cmd__room__join(opt &out, const string_view &line)
|
||||
{
|
||||
const string_view room_id_or_alias
|
||||
{
|
||||
token(line, ' ', 0)
|
||||
};
|
||||
|
||||
const m::user::id &user_id
|
||||
{
|
||||
token(line, ' ', 1)
|
||||
};
|
||||
|
||||
const string_view &event_id
|
||||
{
|
||||
token(line, ' ', 2, {})
|
||||
};
|
||||
|
||||
switch(m::sigil(room_id_or_alias))
|
||||
{
|
||||
case m::id::ROOM:
|
||||
{
|
||||
const m::room room
|
||||
{
|
||||
room_id_or_alias, event_id
|
||||
};
|
||||
|
||||
const auto join_event
|
||||
{
|
||||
m::join(room, user_id)
|
||||
};
|
||||
|
||||
out << join_event << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
case m::id::ROOM_ALIAS:
|
||||
{
|
||||
const m::room::alias alias
|
||||
{
|
||||
room_id_or_alias
|
||||
};
|
||||
|
||||
const auto join_event
|
||||
{
|
||||
m::join(alias, user_id)
|
||||
};
|
||||
|
||||
out << join_event << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
default: throw error
|
||||
{
|
||||
"Don't know how to join '%s'", room_id_or_alias
|
||||
};
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
console_cmd__room__id(opt &out, const string_view &id)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue