mirror of
https://github.com/matrix-construct/construct
synced 2024-09-28 19:58:53 +02:00
modules/console: Add feds perspective cmd.
This commit is contained in:
parent
cd3d790d54
commit
90ea0b4547
1 changed files with 60 additions and 0 deletions
|
@ -4104,6 +4104,66 @@ console_cmd__feds__heads(opt &out, const string_view &line)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
console_cmd__feds__perspective(opt &out, const string_view &line)
|
||||
{
|
||||
const params param{line, " ",
|
||||
{
|
||||
"room_id", "server_name", "key_id",
|
||||
}};
|
||||
|
||||
const auto &room_id
|
||||
{
|
||||
m::room_id(param.at(0))
|
||||
};
|
||||
|
||||
const string_view &server_name
|
||||
{
|
||||
param.at(1)
|
||||
};
|
||||
|
||||
const string_view &key_id
|
||||
{
|
||||
param.at(2)
|
||||
};
|
||||
|
||||
using closure_prototype = bool (const string_view &,
|
||||
std::exception_ptr,
|
||||
const json::array &);
|
||||
|
||||
using prototype = void (const m::room::id &,
|
||||
const m::v1::key::server_key &,
|
||||
const milliseconds &,
|
||||
const std::function<closure_prototype> &);
|
||||
|
||||
static m::import<prototype> feds__perspective
|
||||
{
|
||||
"federation_federation", "feds__perspective"
|
||||
};
|
||||
|
||||
const m::v1::key::server_key server_key
|
||||
{
|
||||
server_name, key_id
|
||||
};
|
||||
|
||||
feds__perspective(room_id, server_key, out.timeout, [&out]
|
||||
(const string_view &origin, std::exception_ptr eptr, const json::array &keys)
|
||||
{
|
||||
if(eptr)
|
||||
return true;
|
||||
|
||||
for(const json::object &_key : keys)
|
||||
{
|
||||
const m::keys &key{_key};
|
||||
out << key << std::endl;
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
console_cmd__feds__backfill(opt &out, const string_view &line)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue