mirror of
https://github.com/matrix-construct/construct
synced 2024-05-28 15:53:46 +02:00
ircd:Ⓜ️:homeserver: Additional my_ tools.
This commit is contained in:
parent
1add5349ac
commit
1f88439bc1
|
@ -29,6 +29,9 @@ namespace ircd::m
|
|||
|
||||
bool for_each(const std::function<bool (homeserver &)> &);
|
||||
|
||||
bool my_origin(const string_view &origin);
|
||||
bool myself(const m::user::id &);
|
||||
|
||||
homeserver &my(const string_view &origin);
|
||||
homeserver &my(); // primary
|
||||
|
||||
|
|
|
@ -85,6 +85,26 @@ ircd::m::my(const string_view &name)
|
|||
return *ptr;
|
||||
}
|
||||
|
||||
bool
|
||||
ircd::m::myself(const m::user::id &user_id)
|
||||
{
|
||||
return !for_each([&user_id]
|
||||
(const auto &homeserver)
|
||||
{
|
||||
return homeserver.self != user_id;
|
||||
});
|
||||
}
|
||||
|
||||
bool
|
||||
ircd::m::my_origin(const string_view &origin)
|
||||
{
|
||||
return !for_each([&origin]
|
||||
(const auto &homeserver)
|
||||
{
|
||||
return m::origin(homeserver) != origin;
|
||||
});
|
||||
}
|
||||
|
||||
bool
|
||||
ircd::m::for_each(const std::function<bool (homeserver &)> &closure)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue