Changeset

3892:96a2e5097fc4

mod_http_muc_log: Reduce hashtable lookups
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Mon, 17 Feb 2020 21:49:15 +0100
parents 3891:38504ec4c89b
children 3893:3f20b7c88afb
files mod_http_muc_log/mod_http_muc_log.lua
diffstat 1 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mod_http_muc_log/mod_http_muc_log.lua	Mon Feb 17 16:42:24 2020 +0100
+++ b/mod_http_muc_log/mod_http_muc_log.lua	Mon Feb 17 21:49:15 2020 +0100
@@ -255,10 +255,11 @@
 	-- Phew, all wrangled, all that's left is rendering it with the template
 
 	response.headers.content_type = "text/html; charset=utf-8";
+	local room_obj = get_room(room);
 	return render(template, {
-		room = get_room(room)._data;
-		jid = get_room(room).jid;
-		jid_node = jid_split(get_room(room).jid);
+		room = room_obj._data;
+		jid = room_obj.jid;
+		jid_node = jid_split(room_obj.jid);
 		hide_presence = hide_presence(request);
 		presence_available = presence_logged;
 		dates = date_list;
@@ -391,14 +392,15 @@
 	end
 
 	response.headers.content_type = "text/html; charset=utf-8";
+	local room_obj = get_room(room);
 	return render(template, {
 		date = date;
-		room = get_room(room)._data;
-		jid = get_room(room).jid;
-		jid_node = jid_split(get_room(room).jid);
+		room = room_obj._data;
+		jid = room_obj.jid;
+		jid_node = jid_split(room_obj.jid);
 		hide_presence = hide_presence(request);
 		presence_available = presence_logged;
-		lang = get_room(room).get_language and get_room(room):get_language();
+		lang = room_obj.get_language and room_obj:get_language();
 		lines = logs;
 		links = links;
 		dates = {}; -- COMPAT util.interpolation {nil|func#...} bug