Software /
code /
prosody-modules
Comparison
mod_http_muc_log/mod_http_muc_log.lua @ 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 |
parent | 3757:971417eedfee |
child | 3893:3f20b7c88afb |
comparison
equal
deleted
inserted
replaced
3891:38504ec4c89b | 3892:96a2e5097fc4 |
---|---|
253 end | 253 end |
254 | 254 |
255 -- Phew, all wrangled, all that's left is rendering it with the template | 255 -- Phew, all wrangled, all that's left is rendering it with the template |
256 | 256 |
257 response.headers.content_type = "text/html; charset=utf-8"; | 257 response.headers.content_type = "text/html; charset=utf-8"; |
258 local room_obj = get_room(room); | |
258 return render(template, { | 259 return render(template, { |
259 room = get_room(room)._data; | 260 room = room_obj._data; |
260 jid = get_room(room).jid; | 261 jid = room_obj.jid; |
261 jid_node = jid_split(get_room(room).jid); | 262 jid_node = jid_split(room_obj.jid); |
262 hide_presence = hide_presence(request); | 263 hide_presence = hide_presence(request); |
263 presence_available = presence_logged; | 264 presence_available = presence_logged; |
264 dates = date_list; | 265 dates = date_list; |
265 links = { | 266 links = { |
266 { href = "../", rel = "up", text = "Room list" }, | 267 { href = "../", rel = "up", text = "Room list" }, |
389 if next_when ~= "" then | 390 if next_when ~= "" then |
390 table.insert(links, { href = next_when, rel = "next", text = next_when}); | 391 table.insert(links, { href = next_when, rel = "next", text = next_when}); |
391 end | 392 end |
392 | 393 |
393 response.headers.content_type = "text/html; charset=utf-8"; | 394 response.headers.content_type = "text/html; charset=utf-8"; |
395 local room_obj = get_room(room); | |
394 return render(template, { | 396 return render(template, { |
395 date = date; | 397 date = date; |
396 room = get_room(room)._data; | 398 room = room_obj._data; |
397 jid = get_room(room).jid; | 399 jid = room_obj.jid; |
398 jid_node = jid_split(get_room(room).jid); | 400 jid_node = jid_split(room_obj.jid); |
399 hide_presence = hide_presence(request); | 401 hide_presence = hide_presence(request); |
400 presence_available = presence_logged; | 402 presence_available = presence_logged; |
401 lang = get_room(room).get_language and get_room(room):get_language(); | 403 lang = room_obj.get_language and room_obj:get_language(); |
402 lines = logs; | 404 lines = logs; |
403 links = links; | 405 links = links; |
404 dates = {}; -- COMPAT util.interpolation {nil|func#...} bug | 406 dates = {}; -- COMPAT util.interpolation {nil|func#...} bug |
405 }); | 407 }); |
406 end | 408 end |