0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2025-01-13 16:33:53 +01:00

ircd:Ⓜ️:room: Add convenience wrapper for event::idx state::get() to interface.

This commit is contained in:
Jason Volk 2019-02-13 14:40:02 -08:00
parent 1a6d173a0b
commit 11264d2806
2 changed files with 20 additions and 1 deletions

View file

@ -68,6 +68,8 @@ struct ircd::m::room
bool has(const string_view &type, const string_view &state_key) const;
bool get(std::nothrow_t, const string_view &type, const string_view &state_key, const event::closure &) const;
void get(const string_view &type, const string_view &state_key, const event::closure &) const;
event::idx get(std::nothrow_t, const string_view &type, const string_view &state_key) const;
event::idx get(const string_view &type, const string_view &state_key) const;
// Convenience passthru to room::messages (linear query)
bool has(const string_view &type) const;

View file

@ -428,7 +428,7 @@ bool
ircd::m::room::has(const string_view &type)
const
{
return get(std::nothrow, type, nullptr);
return get(std::nothrow, type, event::closure{});
}
void
@ -465,6 +465,23 @@ const
return ret;
}
ircd::m::event::idx
ircd::m::room::get(const string_view &type,
const string_view &state_key)
const
{
return state(*this).get(type, state_key);
}
ircd::m::event::idx
ircd::m::room::get(std::nothrow_t,
const string_view &type,
const string_view &state_key)
const
{
return state(*this).get(std::nothrow, type, state_key);
}
void
ircd::m::room::get(const string_view &type,
const string_view &state_key,