0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-27 11:18:51 +02:00

modules/console: Additional argument for fully_read diagnostic.

This commit is contained in:
Jason Volk 2021-01-26 09:04:04 -08:00
parent adb897a444
commit 3d1795630b

View file

@ -12616,6 +12616,11 @@ console_cmd__user__read(opt &out, const string_view &line)
|| !param["room_id"]
};
const bool fully_read
{
param["room_id"] == "***"
};
size_t limit
{
param.at("limit", 32UL)
@ -12669,8 +12674,8 @@ console_cmd__user__read(opt &out, const string_view &line)
out
<< (!hidden? "PUBLIC"_sv: " "_sv)
<< ' ' << std::right << std::setw(12) << ago[1]
<< ' ' << std::left << timef[1]
<< ' ' << std::right << std::setw(12) << ago[bool(receipt_ts.count())]
<< ' ' << std::left << timef[bool(receipt_ts.count())]
<< ' '
;
@ -12705,7 +12710,7 @@ console_cmd__user__read(opt &out, const string_view &line)
user_room, "ircd.read"
};
type.for_each("ircd.read", [&each_event, &limit]
type.for_each([&each_event, &limit]
(const auto &, const auto &, const auto &event_idx) -> bool
{
const m::event::fetch event
@ -12722,6 +12727,34 @@ console_cmd__user__read(opt &out, const string_view &line)
return true;
}
if(fully_read)
{
const m::room::type type
{
user_room, "ircd.account_data!", { -1UL, -1UL }, true
};
type.for_each([&each_event, &limit]
(const auto &, const auto &, const auto &event_idx) -> bool
{
const m::event::fetch event
{
std::nothrow, event_idx
};
if(!event.valid)
return true;
if(json::get<"state_key"_>(event) != "m.fully_read")
return true;
each_event(event);
return --limit;
});
return true;
}
const m::room::state::space space
{
user_room