0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2025-01-16 17:46:54 +01:00

modules/console: Use named params to parse room__set cmd args.

This commit is contained in:
Jason Volk 2018-04-04 22:12:42 -07:00
parent 3ab6409267
commit 9fa017e3aa

View file

@ -1655,29 +1655,37 @@ console_cmd__room__get(opt &out, const string_view &line)
bool bool
console_cmd__room__set(opt &out, const string_view &line) console_cmd__room__set(opt &out, const string_view &line)
{ {
const params param
{
line, " ",
{
"room_id", "sender", "type", "state_key", "content"
}
};
const m::room::id room_id const m::room::id room_id
{ {
token(line, ' ', 0) param.at(0)
}; };
const m::user::id &sender const m::user::id &sender
{ {
token(line, ' ', 1) param.at(1)
}; };
const string_view type const string_view type
{ {
token(line, ' ', 2) param.at(2)
}; };
const string_view state_key const string_view state_key
{ {
token(line, ' ', 3) param.at(3)
}; };
const json::object &content const json::object &content
{ {
token(line, ' ', 4) param.at(4)
}; };
const m::room room const m::room room