mirror of
https://github.com/matrix-construct/construct
synced 2024-11-15 14:31:11 +01:00
ircd:Ⓜ️:room::state: Add convenience to check if state event.
This commit is contained in:
parent
6c43a47d87
commit
8e90f8de5d
2 changed files with 29 additions and 0 deletions
|
@ -109,4 +109,6 @@ struct ircd::m::room::state
|
||||||
static size_t rebuild_present(const state &);
|
static size_t rebuild_present(const state &);
|
||||||
static bool force_present(const event &);
|
static bool force_present(const event &);
|
||||||
static size_t purge_replaced(const state &);
|
static size_t purge_replaced(const state &);
|
||||||
|
static bool is(std::nothrow_t, const event::idx &);
|
||||||
|
static bool is(const event::idx &);
|
||||||
};
|
};
|
||||||
|
|
|
@ -36,6 +36,33 @@ ircd::m::room::purge(const room &room)
|
||||||
return ret;
|
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
|
size_t
|
||||||
ircd::m::room::state::purge_replaced(const state &state)
|
ircd::m::room::state::purge_replaced(const state &state)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue