0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 10:12:39 +01:00

ircd:Ⓜ️:room::origins: Add empty().

This commit is contained in:
Jason Volk 2019-08-13 05:29:48 -07:00
parent 74cef5d74d
commit 1bea1d2265
2 changed files with 14 additions and 1 deletions

View file

@ -32,6 +32,7 @@ struct ircd::m::room::origins
size_t count_online() const;
size_t count_error() const;
size_t count() const;
bool empty() const;
// select an origin in the room at random; use proffer to refuse and try another.
static bool random(const origins &, const closure &, const closure_bool &);

View file

@ -3330,6 +3330,18 @@ ircd::m::room::origins::random(const origins &origins,
return ret;
}
bool
ircd::m::room::origins::empty()
const
{
return for_each(closure_bool{[]
(const string_view &)
{
// return false to break and return false.
return false;
}});
}
size_t
ircd::m::room::origins::count()
const
@ -3350,7 +3362,7 @@ const
size_t ret{0};
for_each([&ret](const string_view &server)
{
ret += !empty(server::errmsg(server));
ret += !ircd::empty(server::errmsg(server));
});
return ret;