0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-07 12:38:56 +02:00

ircd:Ⓜ️ Add room federate query w/ console indicator.

This commit is contained in:
Jason Volk 2018-09-12 23:26:28 -07:00
parent 2ae2bb0eef
commit d3766ee0e5
3 changed files with 33 additions and 5 deletions

View file

@ -29,6 +29,7 @@ namespace ircd::m
bool exists(const id::room &);
bool exists(const id::room_alias &, const bool &remote = false);
uint version(const id::room &);
bool federate(const id::room &);
// [GET]
id::room room_id(const mutable_buffer &, const id::room_alias &);

View file

@ -167,6 +167,32 @@ ircd::m::version(const id::room &room_id)
return ret;
}
bool
ircd::m::federate(const id::room &room_id)
{
static const m::event::fetch::opts fopts
{
event::keys::include
{
"content",
}
};
const m::room::state state
{
room_id, &fopts
};
bool ret;
state.get("m.room.create", "", [&ret]
(const m::event &event)
{
ret = json::get<"content"_>(event).get("m.federate", true);
});
return ret;
}
bool
ircd::m::exists(const id::room &room_id)
{

View file

@ -4404,11 +4404,12 @@ console_cmd__room__top(opt &out, const string_view &line)
m::top(std::nothrow, room_id)
};
out << "idx: " << std::get<m::event::idx>(top) << std::endl;
out << "depth: " << std::get<int64_t>(top) << std::endl;
out << "event: " << std::get<m::event::id::buf>(top) << std::endl;
out << "version: " << m::version(room_id) << std::endl;
out << "m_state: " << std::endl;
out << "idx: " << std::get<m::event::idx>(top) << std::endl;
out << "depth: " << std::get<int64_t>(top) << std::endl;
out << "event: " << std::get<m::event::id::buf>(top) << std::endl;
out << "version: " << m::version(room_id) << std::endl;
out << "federate: " << m::federate(room_id) << std::endl;
out << "m_state: " << std::endl;
const m::room::state state
{