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:
parent
a41420d9e5
commit
345870feb9
1 changed files with 28 additions and 0 deletions
|
@ -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
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue