mirror of
https://github.com/matrix-construct/construct
synced 2024-10-03 06:08:52 +02:00
modules/console: Rework fed key query to allow vector of queries.
This commit is contained in:
parent
5488a85d1a
commit
b3a063bdac
1 changed files with 14 additions and 6 deletions
|
@ -4808,24 +4808,32 @@ console_cmd__fed__key__query(opt &out, const string_view &line)
|
||||||
{
|
{
|
||||||
const params param{line, " ",
|
const params param{line, " ",
|
||||||
{
|
{
|
||||||
"server_name", "key_id", "remote"
|
"remote", "[server_name,key_id]...",
|
||||||
}};
|
}};
|
||||||
|
|
||||||
const unique_buffer<mutable_buffer> buf{24_KiB};
|
const auto requests
|
||||||
const std::pair<string_view, string_view> requesting[]
|
|
||||||
{
|
{
|
||||||
{ param.at(0), param.at(1) }
|
tokens_after(line, ' ', 0)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
std::vector<std::pair<string_view, string_view>> r;
|
||||||
|
tokens(requests, ' ', [&r]
|
||||||
|
(const string_view &req)
|
||||||
|
{
|
||||||
|
r.emplace_back(split(req, ','));
|
||||||
|
});
|
||||||
|
|
||||||
m::v1::key::opts opts;
|
m::v1::key::opts opts;
|
||||||
|
opts.dynamic = true;
|
||||||
opts.remote = net::hostport
|
opts.remote = net::hostport
|
||||||
{
|
{
|
||||||
param.at(2, param.at(0))
|
param.at(0)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const unique_buffer<mutable_buffer> buf{24_KiB};
|
||||||
m::v1::key::query request
|
m::v1::key::query request
|
||||||
{
|
{
|
||||||
requesting, buf, std::move(opts)
|
r, buf, std::move(opts)
|
||||||
};
|
};
|
||||||
|
|
||||||
request.wait(out.timeout);
|
request.wait(out.timeout);
|
||||||
|
|
Loading…
Reference in a new issue