0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 18:22:50 +01:00

ircd:Ⓜ️ Set default version value on not-found to "1".

This commit is contained in:
Jason Volk 2019-07-10 01:30:25 -07:00
parent b7fc4710eb
commit 558428d503

View file

@ -1000,20 +1000,30 @@ ircd::m::version(const mutable_buffer &buf,
const room &room,
std::nothrow_t)
{
string_view ret;
const auto event_idx
{
room.get(std::nothrow, "m.room.create", "")
};
if(!event_idx)
return ret;
m::get(std::nothrow, event_idx, "content", [&ret]
(const json::object &content)
string_view ret
{
ret = unquote(content.get("version", "1"));
});
strlcpy{buf, "1"_sv}
};
if(event_idx)
m::get(std::nothrow, event_idx, "content", [&buf, &ret]
(const json::object &content)
{
const json::string &version
{
content.get("version", "1")
};
ret = strlcpy
{
buf, version
};
});
return ret;
}