diff --git a/include/ircd/m/room.h b/include/ircd/m/room.h index a88151448..948fc27df 100644 --- a/include/ircd/m/room.h +++ b/include/ircd/m/room.h @@ -66,6 +66,7 @@ namespace ircd::m event::id::buf msghtml(const room &, const m::id::user &sender, const string_view &html, const string_view &alt = {}, const string_view &msgtype = "m.notice"); event::id::buf notice(const room &, const m::id::user &sender, const string_view &body); event::id::buf notice(const room &, const string_view &body); // sender is @ircd + event::id::buf invite(const room &, const m::id::user &target, const m::id::user &sender, json::iov &add_content); event::id::buf invite(const room &, const m::id::user &target, const m::id::user &sender); event::id::buf leave(const room &, const m::id::user &); event::id::buf join(const room &, const m::id::user &); diff --git a/ircd/m.cc b/ircd/m.cc index 483b1998b..5c219a90c 100644 --- a/ircd/m.cc +++ b/ircd/m.cc @@ -3884,14 +3884,24 @@ ircd::m::invite(const room &room, const id::user &target, const id::user &sender) { - using prototype = event::id::buf (const m::room &, const id::user &, const id::user &); + json::iov content; + return invite(room, target, sender, content); +} - static mods::import function +ircd::m::event::id::buf +ircd::m::invite(const room &room, + const id::user &target, + const id::user &sender, + json::iov &content) +{ + using prototype = event::id::buf (const m::room &, const id::user &, const id::user &, json::iov &); + + static mods::import call { - "client_rooms", "invite__room_user" + "client_rooms", "ircd::m::invite" }; - return function(room, target, sender); + return call(room, target, sender, content); } ircd::m::event::id::buf diff --git a/modules/client/rooms/invite.cc b/modules/client/rooms/invite.cc index 151c9d0bd..4aac53ac1 100644 --- a/modules/client/rooms/invite.cc +++ b/modules/client/rooms/invite.cc @@ -12,11 +12,6 @@ using namespace ircd; -extern "C" m::event::id::buf -invite__room_user(const m::room &, - const m::user::id &target, - const m::user::id &sender); - extern "C" m::event::id::buf invite__foreign(const m::event &); @@ -37,7 +32,7 @@ post__invite(client &client, const auto event_id { - invite__room_user(room_id, target, sender) + m::invite(room_id, target, sender) }; return resource::response @@ -47,9 +42,11 @@ post__invite(client &client, } m::event::id::buf -invite__room_user(const m::room &room, - const m::user::id &target, - const m::user::id &sender) +IRCD_MODULE_EXPORT +ircd::m::invite(const m::room &room, + const m::user::id &target, + const m::user::id &sender, + json::iov &content) { if(!exists(room)) throw m::NOT_FOUND @@ -59,7 +56,6 @@ invite__room_user(const m::room &room, }; json::iov event; - json::iov content; const json::iov::push push[] { { event, { "type", "m.room.member" }},