0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-26 15:33:54 +01:00

ircd:Ⓜ️ Add function to query if room only has our origin joined.

This commit is contained in:
Jason Volk 2018-06-30 18:48:43 -07:00
parent 8d5229d67d
commit 85d1c924a5
2 changed files with 20 additions and 0 deletions

View file

@ -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,

View file

@ -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)