diff --git a/include/ircd/m/room/room.h b/include/ircd/m/room/room.h index f35aaabd8..ff56d15c4 100644 --- a/include/ircd/m/room/room.h +++ b/include/ircd/m/room/room.h @@ -108,6 +108,8 @@ struct ircd::m::room // Index of create event static event::idx index(const id &, std::nothrow_t); static event::idx index(const id &); + + static size_t purge(const room &); // cuidado! }; inline ircd::m::room::operator diff --git a/ircd/m.cc b/ircd/m.cc index 55539fd2e..f810fb135 100644 --- a/ircd/m.cc +++ b/ircd/m.cc @@ -4036,6 +4036,19 @@ ircd::m::user::ignores::enforce(const string_view &type) // m/room.h // +size_t +ircd::m::room::purge(const room &room) +{ + using prototype = size_t (const m::room &); + + static mods::import call + { + "m_room", "ircd::m::room::purge" + }; + + return call(room); +} + bool ircd::m::room::state::force_present(const event &event) { diff --git a/modules/console.cc b/modules/console.cc index 7bec4ad82..cc27ac831 100644 --- a/modules/console.cc +++ b/modules/console.cc @@ -8271,9 +8271,14 @@ console_cmd__room__id(opt &out, const string_view &id) bool console_cmd__room__purge(opt &out, const string_view &line) { + const params param{line, " ", + { + "room_id", + }}; + const auto &room_id { - m::room_id(token(line, ' ', 0)) + m::room_id(param.at(0)) }; const m::room room @@ -8281,15 +8286,9 @@ console_cmd__room__purge(opt &out, const string_view &line) room_id }; - using prototype = size_t (const m::room &); - static mods::import purge - { - "m_room", "purge" - }; - const size_t ret { - purge(room) + m::room::purge(room) }; out << "erased " << ret << std::endl; diff --git a/modules/m_room.cc b/modules/m_room.cc index 58949d815..fab2ff3f0 100644 --- a/modules/m_room.cc +++ b/modules/m_room.cc @@ -222,8 +222,9 @@ ircd::m::room::origins::random(const origins &origins, return ret; } -extern "C" size_t -purge(const m::room &room) +size_t +IRCD_MODULE_EXPORT +ircd::m::room::purge(const room &room) { size_t ret(0); db::txn txn