diff --git a/modules/console.cc b/modules/console.cc index d1de3cb9f..837ed599f 100644 --- a/modules/console.cc +++ b/modules/console.cc @@ -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 //