mirror of
https://github.com/matrix-construct/construct
synced 2024-11-16 15:00:51 +01:00
modules/console: Add basic node cmd w/ node keys iteration.
This commit is contained in:
parent
dc38da5566
commit
53fedc4c4b
1 changed files with 56 additions and 0 deletions
|
@ -297,6 +297,7 @@ console_cmd__test(opt &out, const string_view &line)
|
||||||
//
|
//
|
||||||
|
|
||||||
bool console_id__user(opt &, const m::user::id &id, const string_view &line);
|
bool console_id__user(opt &, const m::user::id &id, const string_view &line);
|
||||||
|
bool console_id__node(opt &, const m::node::id &id, const string_view &line);
|
||||||
bool console_id__room(opt &, const m::room::id &id, const string_view &line);
|
bool console_id__room(opt &, const m::room::id &id, const string_view &line);
|
||||||
bool console_id__event(opt &, const m::event::id &id, const string_view &line);
|
bool console_id__event(opt &, const m::event::id &id, const string_view &line);
|
||||||
bool console_json(const json::object &);
|
bool console_json(const json::object &);
|
||||||
|
@ -313,6 +314,9 @@ console_command_derived(opt &out, const string_view &line)
|
||||||
case m::id::ROOM:
|
case m::id::ROOM:
|
||||||
return console_id__room(out, id, line);
|
return console_id__room(out, id, line);
|
||||||
|
|
||||||
|
case m::id::NODE:
|
||||||
|
return console_id__node(out, id, line);
|
||||||
|
|
||||||
case m::id::USER:
|
case m::id::USER:
|
||||||
return console_id__user(out, id, line);
|
return console_id__user(out, id, line);
|
||||||
|
|
||||||
|
@ -3604,6 +3608,58 @@ console_cmd__user__read(opt &out, const string_view &line)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// node
|
||||||
|
//
|
||||||
|
|
||||||
|
//TODO: XXX
|
||||||
|
bool
|
||||||
|
console_id__node(opt &out,
|
||||||
|
const m::node::id &id,
|
||||||
|
const string_view &args)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
console_cmd__node__keys(opt &out, const string_view &line)
|
||||||
|
{
|
||||||
|
const params param{line, " ",
|
||||||
|
{
|
||||||
|
"node_id", "[limit]"
|
||||||
|
}};
|
||||||
|
|
||||||
|
const m::node &node
|
||||||
|
{
|
||||||
|
param.at(0)
|
||||||
|
};
|
||||||
|
|
||||||
|
auto limit
|
||||||
|
{
|
||||||
|
param.at(1, size_t(1))
|
||||||
|
};
|
||||||
|
|
||||||
|
const m::node::room node_room
|
||||||
|
{
|
||||||
|
node
|
||||||
|
};
|
||||||
|
|
||||||
|
const m::room::state state{node_room};
|
||||||
|
state.for_each("ircd.key", [&out, &limit]
|
||||||
|
(const m::event &event)
|
||||||
|
{
|
||||||
|
const m::keys keys
|
||||||
|
{
|
||||||
|
json::get<"content"_>(event)
|
||||||
|
};
|
||||||
|
|
||||||
|
out << keys << std::endl;
|
||||||
|
return --limit;
|
||||||
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// feds
|
// feds
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in a new issue