From 888839276810898e1eedb1aa1537177499b13d6b Mon Sep 17 00:00:00 2001
From: Jason Volk <jason@zemos.net>
Date: Sun, 4 Aug 2019 22:50:40 -0700
Subject: [PATCH] modules/console: Add recent events to room top.

---
 modules/console.cc | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/modules/console.cc b/modules/console.cc
index 8a0bdff35..c63dbaa4d 100644
--- a/modules/console.cc
+++ b/modules/console.cc
@@ -7626,6 +7626,8 @@ console_cmd__rooms__fetch(opt &out, const string_view &line)
 // room
 //
 
+bool console_cmd__room__events(opt &out, const string_view &line);
+
 bool
 console_cmd__room__top(opt &out, const string_view &line)
 {
@@ -7685,6 +7687,18 @@ console_cmd__room__top(opt &out, const string_view &line)
 		return true;
 	}});
 
+	out << "\nrecent events:"
+	    << std::endl;
+
+	char linebuf[256];
+	static const size_t last_count(4);
+	console_cmd__room__events(out, fmt::sprintf
+	{
+		linebuf, "%s -%ld",
+		string_view{room_id},
+		last_count,
+	});
+
 	return true;
 }