mirror of
https://github.com/matrix-construct/construct
synced 2024-11-26 00:32:35 +01:00
ircd:Ⓜ️ Add type(room) to interface.
This commit is contained in:
parent
bdc88e6c7e
commit
e57561e8c1
2 changed files with 29 additions and 0 deletions
|
@ -32,6 +32,7 @@ namespace ircd::m
|
|||
bool federate(const id::room &);
|
||||
id::user::buf creator(const id::room &);
|
||||
bool creator(const id::room &, const id::user &);
|
||||
string_view type(const mutable_buffer &, const room &);
|
||||
string_view version(const mutable_buffer &, const room &, std::nothrow_t);
|
||||
string_view version(const mutable_buffer &, const room &);
|
||||
|
||||
|
|
|
@ -1031,6 +1031,34 @@ ircd::m::version(const mutable_buffer &buf,
|
|||
return ret;
|
||||
}
|
||||
|
||||
ircd::string_view
|
||||
ircd::m::type(const mutable_buffer &buf,
|
||||
const room &room)
|
||||
{
|
||||
string_view ret;
|
||||
const auto event_idx
|
||||
{
|
||||
room.get(std::nothrow, "m.room.create", "")
|
||||
};
|
||||
|
||||
if(event_idx)
|
||||
m::get(std::nothrow, event_idx, "content", [&buf, &ret]
|
||||
(const json::object &content)
|
||||
{
|
||||
const json::string &type
|
||||
{
|
||||
content.get("type")
|
||||
};
|
||||
|
||||
ret = strlcpy
|
||||
{
|
||||
buf, type
|
||||
};
|
||||
});
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool
|
||||
ircd::m::creator(const id::room &room_id,
|
||||
const id::user &user_id)
|
||||
|
|
Loading…
Reference in a new issue