From 2158d3e7b6be0124b666aa95aa98b64dfa06b3ce Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sat, 16 Mar 2019 19:38:33 -0700 Subject: [PATCH] modules/client/rooms/report: Create !abuse room with !ircd init hook. --- modules/client/rooms/report.cc | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/modules/client/rooms/report.cc b/modules/client/rooms/report.cc index 72d1434b6..52828845b 100644 --- a/modules/client/rooms/report.cc +++ b/modules/client/rooms/report.cc @@ -12,6 +12,8 @@ using namespace ircd; +static void create_report_room(const m::event &, m::vm::eval &); + const m::room::id::buf report_room_id { @@ -25,6 +27,17 @@ reason_max { "default", 512L } }; +const m::hookfn +create_report_room_hook +{ + create_report_room, + { + { "_site", "vm.effect" }, + { "room_id", "!ircd" }, + { "type", "m.room.create" }, + } +}; + resource::response post__report(client &client, const resource::request &request, @@ -90,13 +103,9 @@ post__report(client &client, }; } -struct create_report_room -{ - create_report_room(); -} -static create_report_room; - -create_report_room::create_report_room() +void +create_report_room(const m::event &, + m::vm::eval &) try { if(m::exists(report_room_id))