mirror of
https://github.com/matrix-construct/construct
synced 2025-03-14 05:20:17 +01:00
ircd:Ⓜ️:homeserver: Additional my_ tools.
This commit is contained in:
parent
1add5349ac
commit
1f88439bc1
2 changed files with 23 additions and 0 deletions
|
@ -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…
Add table
Reference in a new issue