0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-02 18:18:56 +02:00

ircd:Ⓜ️:room: Add central interface linkage for room::purge().

This commit is contained in:
Jason Volk 2019-03-25 18:03:42 -07:00
parent 3018062345
commit 1ffa00adbf
4 changed files with 25 additions and 10 deletions

View file

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

View file

@ -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<prototype> call
{
"m_room", "ircd::m::room::purge"
};
return call(room);
}
bool
ircd::m::room::state::force_present(const event &event)
{

View file

@ -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<prototype> purge
{
"m_room", "purge"
};
const size_t ret
{
purge(room)
m::room::purge(room)
};
out << "erased " << ret << std::endl;

View file

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