mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 10:12:39 +01:00
ircd:Ⓜ️:create: Add a central room_version default conf item.
This commit is contained in:
parent
aaa015c6b8
commit
cd347d53cb
3 changed files with 26 additions and 6 deletions
|
@ -106,5 +106,7 @@ struct ircd::m::createroom
|
||||||
json::property<name::room_version, json::string>
|
json::property<name::room_version, json::string>
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
|
static conf::item<std::string> version_default;
|
||||||
|
|
||||||
using super_type::tuple;
|
using super_type::tuple;
|
||||||
};
|
};
|
||||||
|
|
|
@ -53,7 +53,7 @@ ircd::m::client_capabilities::get(client &client,
|
||||||
|
|
||||||
const json::value default_room_version
|
const json::value default_room_version
|
||||||
{
|
{
|
||||||
"1", json::STRING
|
string_view{m::createroom::version_default}, json::STRING
|
||||||
};
|
};
|
||||||
|
|
||||||
return resource::response
|
return resource::response
|
||||||
|
|
|
@ -70,6 +70,14 @@ spec_preset(const string_view &preset)
|
||||||
return std::find(begin(spec_presets), end(spec_presets), preset) != end(spec_presets);
|
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
|
resource::response
|
||||||
post__createroom(client &client,
|
post__createroom(client &client,
|
||||||
const resource::request::object<m::createroom> &request)
|
const resource::request::object<m::createroom> &request)
|
||||||
|
@ -79,6 +87,12 @@ post__createroom(client &client,
|
||||||
request
|
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;
|
json::get<"creator"_>(c) = request.user_id;
|
||||||
|
|
||||||
const m::id::room::buf room_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" },
|
json::get<"room_version"_>(c)?
|
||||||
{ "default", "4" },
|
string_view{json::get<"room_version"_>(c)}:
|
||||||
|
string_view{m::createroom::version_default}
|
||||||
};
|
};
|
||||||
|
|
||||||
const json::iov::push _room_version
|
const json::iov::push _room_version
|
||||||
{
|
{
|
||||||
content,
|
content,
|
||||||
{
|
{
|
||||||
"room_version", json::value { default_version, json::STRING }
|
"room_version", json::value
|
||||||
|
{
|
||||||
|
room_version, json::STRING
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
m::vm::copts opts;
|
m::vm::copts opts;
|
||||||
opts.room_version = default_version;
|
opts.room_version = room_version;
|
||||||
opts.verify = false;
|
opts.verify = false;
|
||||||
m::vm::eval
|
m::vm::eval
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue