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:
parent
f8763af509
commit
7d4eb46a1a
3 changed files with 20 additions and 5 deletions
|
@ -52,6 +52,7 @@ struct ircd::m::user
|
||||||
event::id::buf profile(const m::user &sender, const string_view &key, const string_view &value);
|
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 &)>;
|
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 string_view &type, const account_data_closure &) const;
|
||||||
void account_data(const m::room &, 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;
|
bool account_data(std::nothrow_t, const string_view &type, const account_data_closure &) const;
|
||||||
|
|
14
ircd/m/m.cc
14
ircd/m/m.cc
|
@ -2060,6 +2060,20 @@ const
|
||||||
return function(*this, type, closure);
|
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::event::id::buf
|
||||||
ircd::m::user::profile(const m::user &sender,
|
ircd::m::user::profile(const m::user &sender,
|
||||||
const string_view &key,
|
const string_view &key,
|
||||||
|
|
|
@ -186,9 +186,9 @@ room_account_data_typebuf_size
|
||||||
m::room::id::MAX_SIZE + size(room_account_data_type_prefix)
|
m::room::id::MAX_SIZE + size(room_account_data_type_prefix)
|
||||||
};
|
};
|
||||||
|
|
||||||
static string_view
|
extern "C" string_view
|
||||||
make_type(const mutable_buffer &out,
|
room_account_data_type(const mutable_buffer &out,
|
||||||
const m::room::id &room_id)
|
const m::room::id &room_id)
|
||||||
{
|
{
|
||||||
assert(size(out) >= room_account_data_typebuf_size);
|
assert(size(out) >= room_account_data_typebuf_size);
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ try
|
||||||
char typebuf[room_account_data_typebuf_size];
|
char typebuf[room_account_data_typebuf_size];
|
||||||
const string_view type
|
const string_view type
|
||||||
{
|
{
|
||||||
make_type(typebuf, room.room_id)
|
room_account_data_type(typebuf, room.room_id)
|
||||||
};
|
};
|
||||||
|
|
||||||
const m::user::room user_room
|
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];
|
char typebuf[room_account_data_typebuf_size];
|
||||||
const string_view type
|
const string_view type
|
||||||
{
|
{
|
||||||
make_type(typebuf, room.room_id)
|
room_account_data_type(typebuf, room.room_id)
|
||||||
};
|
};
|
||||||
|
|
||||||
const m::user::room user_room
|
const m::user::room user_room
|
||||||
|
|
Loading…
Reference in a new issue