mirror of
https://github.com/matrix-construct/construct
synced 2025-02-18 01:30:12 +01:00
ircd:Ⓜ️ Add additional membership multi-test convenience tool.
This commit is contained in:
parent
1882f7b507
commit
2e2c85902e
2 changed files with 13 additions and 0 deletions
|
@ -37,6 +37,7 @@ namespace ircd::m
|
|||
// is equal to any of the strings (including the non-membership empty
|
||||
// string described above) these functions return true. An empty vector is
|
||||
// also a non-membership query.
|
||||
bool membership(const event &, const vector_view<const string_view> &);
|
||||
bool membership(const event::idx &, const vector_view<const string_view> &);
|
||||
bool membership(const room &, const id::user &, const vector_view<const string_view> &);
|
||||
|
||||
|
|
|
@ -82,6 +82,18 @@ ircd::m::membership(const event::idx &event_idx,
|
|||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
ircd::m::membership(const m::event &event,
|
||||
const vector_view<const string_view> &membership)
|
||||
{
|
||||
const auto it
|
||||
{
|
||||
std::find(begin(membership), end(membership), m::membership(event))
|
||||
};
|
||||
|
||||
return it != end(membership);
|
||||
}
|
||||
|
||||
ircd::string_view
|
||||
ircd::m::membership(const mutable_buffer &out,
|
||||
const room &room,
|
||||
|
|
Loading…
Add table
Reference in a new issue