mirror of
https://github.com/matrix-construct/construct
synced 2024-11-25 16:22:35 +01:00
ircd:Ⓜ️ Add function to query if room only has our origin joined.
This commit is contained in:
parent
8d5229d67d
commit
85d1c924a5
2 changed files with 20 additions and 0 deletions
|
@ -147,6 +147,7 @@ struct ircd::m::room
|
|||
bool membership(const m::id::user &, const string_view &membership = "join") const;
|
||||
string_view membership(const mutable_buffer &out, const m::id::user &) const;
|
||||
bool visible(const string_view &mxid, const m::event *const & = nullptr) const;
|
||||
bool lonly() const;
|
||||
|
||||
room(const id &room_id,
|
||||
const string_view &event_id,
|
||||
|
|
|
@ -161,6 +161,25 @@ ircd::m::my(const room &room)
|
|||
// room
|
||||
//
|
||||
|
||||
/// The only joined members are from our origin (local only). This indicates
|
||||
/// we won't have any other federation servers to query for room data, nor do
|
||||
/// we need to broadcast events to the federation. This is not an authority
|
||||
/// about a room's type or ability to federate. Returned value changes to false
|
||||
/// when another origin joins.
|
||||
bool
|
||||
ircd::m::room::lonly()
|
||||
const
|
||||
{
|
||||
const origins origins(*this);
|
||||
if(origins.count() != 1)
|
||||
return false;
|
||||
|
||||
if(!origins.has(m::my_host()))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ircd::m::room::visible(const string_view &mxid,
|
||||
const event *const &event)
|
||||
|
|
Loading…
Reference in a new issue