0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-26 00:32:35 +01:00

modules/console: Add basic user read command.

This commit is contained in:
Jason Volk 2018-04-12 02:38:56 -07:00
parent a41420d9e5
commit 345870feb9

View file

@ -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
//