mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 10:12:39 +01:00
ircd:Ⓜ️:user: Add mitsein::count() interface.
This commit is contained in:
parent
8c87fbed46
commit
39b49599e5
2 changed files with 30 additions and 0 deletions
|
@ -141,6 +141,9 @@ struct ircd::m::user::mitsein
|
|||
void for_each(const closure_bool &) const;
|
||||
void for_each(const closure &) const;
|
||||
|
||||
size_t count(const m::user &, const string_view &membership = {}) const;
|
||||
size_t count(const string_view &membership = {}) const;
|
||||
|
||||
mitsein(const m::user &user);
|
||||
};
|
||||
|
||||
|
|
27
ircd/m/m.cc
27
ircd/m/m.cc
|
@ -2049,6 +2049,33 @@ ircd::m::user::mitsein::mitsein(const m::user &user)
|
|||
{
|
||||
}
|
||||
|
||||
size_t
|
||||
ircd::m::user::mitsein::count(const string_view &membership)
|
||||
const
|
||||
{
|
||||
size_t ret{0};
|
||||
for_each(membership, [&ret](const m::user &)
|
||||
{
|
||||
++ret;
|
||||
});
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
size_t
|
||||
ircd::m::user::mitsein::count(const m::user &user,
|
||||
const string_view &membership)
|
||||
const
|
||||
{
|
||||
size_t ret{0};
|
||||
for_each(user, membership, [&ret](const m::room &, const string_view &)
|
||||
{
|
||||
++ret;
|
||||
});
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
ircd::m::user::mitsein::for_each(const closure &closure)
|
||||
const
|
||||
|
|
Loading…
Reference in a new issue