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

modules/console: Add user filter cmd.

This commit is contained in:
Jason Volk 2018-05-12 16:09:24 -07:00
parent 1d7fce8368
commit b414593443

View file

@ -3630,6 +3630,43 @@ console_cmd__user__read(opt &out, const string_view &line)
return true;
}
bool
console_cmd__user__filter(opt &out, const string_view &line)
{
const params param{line, " ",
{
"user_id", "[filter_id]"
}};
const m::user user
{
param.at(0)
};
const auto &filter_id
{
param[1]
};
if(filter_id)
{
out << user.filter(filter_id) << std::endl;
return true;
}
const m::user::room user_room{user};
const m::room::state state{user_room};
state.for_each("ircd.filter", m::event::closure{[&out]
(const m::event &event)
{
out << at<"state_key"_>(event) << std::endl;
out << at<"content"_>(event) << std::endl;
out << std::endl;
}});
return true;
}
//
// node
//