From 6f60b9bed8955504388f35616330380c48e20979 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sun, 25 Aug 2019 19:28:06 -0700 Subject: [PATCH] ircd::m: Simplify send() impl linkage. --- ircd/m_room.cc | 21 +++++++++++---------- modules/client/rooms/send.cc | 19 +------------------ modules/client/rooms/state.cc | 21 +-------------------- 3 files changed, 13 insertions(+), 48 deletions(-) diff --git a/ircd/m_room.cc b/ircd/m_room.cc index e26246f46..475c56eed 100644 --- a/ircd/m_room.cc +++ b/ircd/m_room.cc @@ -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 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 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 diff --git a/modules/client/rooms/send.cc b/modules/client/rooms/send.cc index c67986a49..6655c10f2 100644 --- a/modules/client/rooms/send.cc +++ b/modules/client/rooms/send.cc @@ -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, diff --git a/modules/client/rooms/state.cc b/modules/client/rooms/state.cc index 7b368a62b..9ad7a54b6 100644 --- a/modules/client/rooms/state.cc +++ b/modules/client/rooms/state.cc @@ -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); -}