From 345870feb93c32c8b5d75ec2b5138b65201a8f3f Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Thu, 12 Apr 2018 02:38:56 -0700 Subject: [PATCH] modules/console: Add basic user read command. --- modules/console.cc | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/modules/console.cc b/modules/console.cc index dcc19a13e..c949e8695 100644 --- a/modules/console.cc +++ b/modules/console.cc @@ -2158,6 +2158,34 @@ console_cmd__user__presence(opt &out, const string_view &line) return true; } +bool +console_cmd__user__read(opt &out, const string_view &line) +{ + const params param{line, " ", + { + "user_id", + }}; + + const m::user user + { + param.at(0) + }; + + const m::user::room user_room{user}; + const m::room::state state{user_room}; + state.for_each("m.read", m::event::closure{[&out] + (const m::event &event) + { + out << timestr(at<"origin_server_ts"_>(event) / 1000) + << " " << at<"state_key"_>(event) + << " " << at<"content"_>(event) + << " " << at<"event_id"_>(event) + << std::endl; + }}); + + return true; +} + // // feds //