0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-25 16:22:35 +01:00

modules/m_room_create: Minor cleanup.

This commit is contained in:
Jason Volk 2019-07-20 16:32:22 -07:00
parent e1356fb50d
commit 8bbf8c4cbb

View file

@ -10,11 +10,11 @@
namespace ircd::m namespace ircd::m
{ {
static void created_room(const event &, vm::eval &);
extern hookfn<vm::eval &> created_room_hookfn;
static void auth_room_create(const event &, event::auth::hookdata &); static void auth_room_create(const event &, event::auth::hookdata &);
extern hookfn<event::auth::hookdata &> auth_room_create_hookfn; extern hookfn<event::auth::hookdata &> auth_room_create_hookfn;
static void created_room(const event &, vm::eval &);
extern hookfn<vm::eval &> created_room_hookfn;
} }
ircd::mapi::header ircd::mapi::header
@ -23,6 +23,10 @@ IRCD_MODULE
"Matrix m.room.create" "Matrix m.room.create"
}; };
//
// an effect of room created
//
decltype(ircd::m::created_room_hookfn) decltype(ircd::m::created_room_hookfn)
ircd::m::created_room_hookfn ircd::m::created_room_hookfn
{ {
@ -59,6 +63,10 @@ ircd::m::created_room(const m::event &event,
}; };
} }
//
// auth handler
//
decltype(ircd::m::auth_room_create_hookfn) decltype(ircd::m::auth_room_create_hookfn)
ircd::m::auth_room_create_hookfn ircd::m::auth_room_create_hookfn
{ {
@ -75,6 +83,8 @@ ircd::m::auth_room_create(const event &event,
{ {
using FAIL = m::event::auth::FAIL; using FAIL = m::event::auth::FAIL;
using conforms = m::event::conforms; using conforms = m::event::conforms;
// 1. If type is m.room.create:
assert(json::get<"type"_>(event) == "m.room.create"); assert(json::get<"type"_>(event) == "m.room.create");
// a. If it has any previous events, reject. // a. If it has any previous events, reject.