From adb897a444bdbf5c502ce28e5c5a30caafe2d194 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Tue, 26 Jan 2021 08:51:52 -0800 Subject: [PATCH] modules/console: Add argument for eye track diagnostic. --- modules/console.cc | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/modules/console.cc b/modules/console.cc index 60aa10c8a..6b9c4eff2 100644 --- a/modules/console.cc +++ b/modules/console.cc @@ -12600,11 +12600,22 @@ console_cmd__user__read(opt &out, const string_view &line) const auto room_id { - param["room_id"]? + param["room_id"] && !startswith(param["room_id"], '*')? m::room_id(param["room_id"]): m::room::id::buf{} }; + const bool all_rooms + { + param["room_id"] == "*" + }; + + const bool eye_track + { + param["room_id"] == "**" + || !param["room_id"] + }; + size_t limit { param.at("limit", 32UL) @@ -12676,7 +12687,7 @@ console_cmd__user__read(opt &out, const string_view &line) out << std::endl; }}; - if(!room_id) + if(all_rooms) { const m::room::state state { @@ -12687,6 +12698,30 @@ console_cmd__user__read(opt &out, const string_view &line) return true; } + if(eye_track) + { + const m::room::type type + { + user_room, "ircd.read" + }; + + type.for_each("ircd.read", [&each_event, &limit] + (const auto &, const auto &, const auto &event_idx) -> bool + { + const m::event::fetch event + { + std::nothrow, event_idx + }; + + if(likely(event.valid)) + each_event(event); + + return --limit; + }); + + return true; + } + const m::room::state::space space { user_room