0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 10:12:39 +01:00

ircd:Ⓜ️ Interface/linkage to generate room account_data type string.

This commit is contained in:
Jason Volk 2018-06-19 21:40:42 -06:00
parent f8763af509
commit 7d4eb46a1a
3 changed files with 20 additions and 5 deletions

View file

@ -52,6 +52,7 @@ struct ircd::m::user
event::id::buf profile(const m::user &sender, const string_view &key, const string_view &value);
using account_data_closure = std::function<void (const json::object &)>;
static string_view _account_data_type(const mutable_buffer &out, const m::room::id &);
void account_data(const string_view &type, const account_data_closure &) const;
void account_data(const m::room &, const string_view &type, const account_data_closure &) const;
bool account_data(std::nothrow_t, const string_view &type, const account_data_closure &) const;

View file

@ -2060,6 +2060,20 @@ const
return function(*this, type, closure);
}
ircd::string_view
ircd::m::user::_account_data_type(const mutable_buffer &out,
const m::room::id &room_id)
{
using prototype = string_view (const mutable_buffer &, const m::room::id &);
static import<prototype> function
{
"client_user", "room_account_data_type"
};
return function(out, room_id);
}
ircd::m::event::id::buf
ircd::m::user::profile(const m::user &sender,
const string_view &key,

View file

@ -186,9 +186,9 @@ room_account_data_typebuf_size
m::room::id::MAX_SIZE + size(room_account_data_type_prefix)
};
static string_view
make_type(const mutable_buffer &out,
const m::room::id &room_id)
extern "C" string_view
room_account_data_type(const mutable_buffer &out,
const m::room::id &room_id)
{
assert(size(out) >= room_account_data_typebuf_size);
@ -208,7 +208,7 @@ try
char typebuf[room_account_data_typebuf_size];
const string_view type
{
make_type(typebuf, room.room_id)
room_account_data_type(typebuf, room.room_id)
};
const m::user::room user_room
@ -248,7 +248,7 @@ room_account_data_set(const m::user &user,
char typebuf[room_account_data_typebuf_size];
const string_view type
{
make_type(typebuf, room.room_id)
room_account_data_type(typebuf, room.room_id)
};
const m::user::room user_room