From 4c2f90273aa66f9326ea7be517a7d4a5860b1058 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Thu, 26 Apr 2018 20:39:54 -0700 Subject: [PATCH] modules/console: Rename room messages to events; add room roots; add special opt. --- modules/console.cc | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/modules/console.cc b/modules/console.cc index dbf9d1e4e..a84b87c7d 100644 --- a/modules/console.cc +++ b/modules/console.cc @@ -34,6 +34,7 @@ struct opt std::ostream &out; bool html {false}; seconds timeout {30}; + string_view special; operator std::ostream &() { @@ -2668,7 +2669,7 @@ console_cmd__room__count(opt &out, const string_view &line) } bool -console_cmd__room__messages(opt &out, const string_view &line) +console_cmd__room__events(opt &out, const string_view &line) { const params param{line, " ", { @@ -2697,6 +2698,11 @@ console_cmd__room__messages(opt &out, const string_view &line) param.at(3, ssize_t(32)) }; + const bool roots + { + has(out.special, "roots") + }; + const m::room room { room_id @@ -2707,11 +2713,26 @@ console_cmd__room__messages(opt &out, const string_view &line) it.seek(depth); for(; it && limit >= 0; order == 'b'? --it : ++it, --limit) - out << pretty_oneline(*it) << std::endl; + if(roots) + out << std::setw(40) << std::left << it.state_root() + << " " << std::setw(8) << std::left << it.event_idx() + << " " << it.event_id() + << std::endl; + else + out << pretty_oneline(*it) + << std::endl; return true; } +bool +console_cmd__room__roots(opt &out, const string_view &line) +{ + assert(!out.special); + out.special = "roots"; + return console_cmd__room__events(out, line); +} + bool console_cmd__room__get(opt &out, const string_view &line) {