0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 18:22:50 +01:00

ircd:Ⓜ️:room::state: Add convenience to check if state event.

This commit is contained in:
Jason Volk 2019-05-06 20:47:12 -07:00
parent 6c43a47d87
commit 8e90f8de5d
2 changed files with 29 additions and 0 deletions

View file

@ -109,4 +109,6 @@ struct ircd::m::room::state
static size_t rebuild_present(const state &);
static bool force_present(const event &);
static size_t purge_replaced(const state &);
static bool is(std::nothrow_t, const event::idx &);
static bool is(const event::idx &);
};

View file

@ -36,6 +36,33 @@ ircd::m::room::purge(const room &room)
return ret;
}
bool
ircd::m::room::state::is(const event::idx &event_idx)
{
bool ret{false};
m::get(event_idx, "state_key", [&ret]
(const string_view &state_key)
{
ret = true;
});
return ret;
}
bool
ircd::m::room::state::is(std::nothrow_t,
const event::idx &event_idx)
{
bool ret{false};
m::get(std::nothrow, event_idx, "state_key", [&ret]
(const string_view &state_key)
{
ret = true;
});
return ret;
}
size_t
ircd::m::room::state::purge_replaced(const state &state)
{