0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-26 00:32:35 +01:00

ircd:Ⓜ️:create: Add a central room_version default conf item.

This commit is contained in:
Jason Volk 2019-08-15 22:36:14 -07:00
parent aaa015c6b8
commit cd347d53cb
3 changed files with 26 additions and 6 deletions

View file

@ -106,5 +106,7 @@ struct ircd::m::createroom
json::property<name::room_version, json::string>
>
{
static conf::item<std::string> version_default;
using super_type::tuple;
};

View file

@ -53,7 +53,7 @@ ircd::m::client_capabilities::get(client &client,
const json::value default_room_version
{
"1", json::STRING
string_view{m::createroom::version_default}, json::STRING
};
return resource::response

View file

@ -70,6 +70,14 @@ spec_preset(const string_view &preset)
return std::find(begin(spec_presets), end(spec_presets), preset) != end(spec_presets);
}
decltype(ircd::m::createroom::version_default)
IRCD_MODULE_EXPORT_DATA
ircd::m::createroom::version_default
{
{ "name", "ircd.m.createroom.version_default" },
{ "default", "5" },
};
resource::response
post__createroom(client &client,
const resource::request::object<m::createroom> &request)
@ -79,6 +87,12 @@ post__createroom(client &client,
request
};
// unconditionally set/override the room_version here
json::get<"room_version"_>(c) = string_view
{
m::createroom::version_default
};
json::get<"creator"_>(c) = request.user_id;
const m::id::room::buf room_id
@ -497,22 +511,26 @@ ircd::m::_create_event(const createroom &c)
}
};
static conf::item<std::string> default_version
const string_view &room_version
{
{ "name", "ircd.m.room.create.version_default" },
{ "default", "4" },
json::get<"room_version"_>(c)?
string_view{json::get<"room_version"_>(c)}:
string_view{m::createroom::version_default}
};
const json::iov::push _room_version
{
content,
{
"room_version", json::value { default_version, json::STRING }
"room_version", json::value
{
room_version, json::STRING
}
}
};
m::vm::copts opts;
opts.room_version = default_version;
opts.room_version = room_version;
opts.verify = false;
m::vm::eval
{