0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2025-01-18 02:21:56 +01:00

ircd:Ⓜ️:room: Augment m::invite() convenience interface for custom content.

This commit is contained in:
Jason Volk 2019-03-14 15:21:51 -07:00
parent 240c181b16
commit 380032d4a9
3 changed files with 21 additions and 14 deletions

View file

@ -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 &);

View file

@ -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<prototype> 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<prototype> 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

View file

@ -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" }},