0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-27 11:18:51 +02:00

ircd:Ⓜ️ Simplify send() impl linkage.

This commit is contained in:
Jason Volk 2019-08-25 19:28:06 -07:00
parent 9b5ffb0b1f
commit 6f60b9bed8
3 changed files with 13 additions and 48 deletions

View file

@ -532,14 +532,15 @@ ircd::m::send(const room &room,
const string_view &state_key,
const json::iov &content)
{
using prototype = event::id::buf (const m::room &, const id::user &, const string_view &, const string_view &, const json::iov &);
static mods::import<prototype> function
json::iov event;
const json::iov::push push[]
{
"client_rooms", "ircd::m::send"
{ event, { "sender", sender }},
{ event, { "type", type }},
{ event, { "state_key", state_key }},
};
return function(room, sender, type, state_key, content);
return commit(room, event, content);
}
#pragma GCC diagnostic push
@ -588,14 +589,14 @@ ircd::m::send(const room &room,
const string_view &type,
const json::iov &content)
{
using prototype = event::id::buf (const m::room &, const id::user &, const string_view &, const json::iov &);
static mods::import<prototype> function
json::iov event;
const json::iov::push push[]
{
"client_rooms", "ircd::m::send"
{ event, { "sender", sender }},
{ event, { "type", type }},
};
return function(room, sender, type, content);
return commit(room, event, content);
}
ircd::m::event::id::buf

View file

@ -85,7 +85,7 @@ put__send(client &client,
const auto event_id
{
send(room, request.user_id, type, content)
m::send(room, request.user_id, type, content)
};
return resource::response
@ -97,23 +97,6 @@ put__send(client &client,
};
}
ircd::m::event::id::buf
IRCD_MODULE_EXPORT
ircd::m::send(const m::room &room,
const m::id::user &sender,
const string_view &type,
const json::iov &content)
{
json::iov event;
const json::iov::push push[]
{
{ event, { "sender", sender }},
{ event, { "type", type }},
};
return commit(room, event, content);
}
resource::response
handle_command(client &client,
const resource::request &request,

View file

@ -50,7 +50,7 @@ put__state(client &client,
const auto event_id
{
send(room_id, request.user_id, type, state_key, content)
m::send(room_id, request.user_id, type, state_key, content)
};
return resource::response
@ -165,22 +165,3 @@ get__state(client &client,
return std::move(response);
}
m::event::id::buf
IRCD_MODULE_EXPORT
ircd::m::send(const m::room &room,
const m::id::user &sender,
const string_view &type,
const string_view &state_key,
const json::iov &content)
{
json::iov event;
const json::iov::push push[]
{
{ event, { "sender", sender }},
{ event, { "type", type }},
{ event, { "state_key", state_key }},
};
return commit(room, event, content);
}