From d07da4471880678d5ef20c91503a4a506917d44d Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Fri, 13 Apr 2018 14:04:36 -0700 Subject: [PATCH] modules/console: Add user rooms command. --- modules/console.cc | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/modules/console.cc b/modules/console.cc index 2f3d13f4a..6a5de8257 100644 --- a/modules/console.cc +++ b/modules/console.cc @@ -2203,6 +2203,40 @@ console_cmd__user__presence(opt &out, const string_view &line) return true; } +bool +console_cmd__user__rooms(opt &out, const string_view &line) +{ + const params param{line, " ", + { + "user_id", "[membership]" + }}; + + const m::user &user + { + param.at(0) + }; + + const string_view &membership + { + param[1] + }; + + const m::user::rooms rooms + { + user + }; + + rooms.for_each(membership, m::user::rooms::closure{[&out] + (const m::room &room, const string_view &membership) + { + out << room.room_id + << " " << membership + << std::endl; + }}); + + return true; +} + bool console_cmd__user__read(opt &out, const string_view &line) {