0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-19 16:30:52 +01:00

modules/console: Add room visible diagnostic cmd.

This commit is contained in:
Jason Volk 2018-05-31 11:09:33 -07:00
parent 499c6f4f21
commit 3b7df8069b

View file

@ -3879,6 +3879,54 @@ console_cmd__room__depth(opt &out, const string_view &line)
return true;
}
bool
console_cmd__room__visible(opt &out, const string_view &line)
{
const params param{line, " ",
{
"room_id", "user_id|node_id", "event_id"
}};
const auto &room_id
{
m::room_id(param.at(0))
};
const string_view &mxid
{
param[1] && param[1] != "*"?
param[1]:
param[1] == "*"?
string_view{}:
param[1]
};
const auto &event_id
{
param[2]
};
const m::room room
{
room_id, event_id
};
const bool visible
{
room.visible(mxid)
};
out << room_id << " is "
<< (visible? "VISIBLE" : "NOT VISIBLE")
<< (mxid? " to " : "")
<< mxid
<< (event_id? " at " : "")
<< event_id
<< std::endl;
return true;
}
bool
console_cmd__room__members(opt &out, const string_view &line)
{