# HG changeset patch # User Kim Alvefur # Date 1557701555 -7200 # Node ID 6e529f53b3c3dde57eb85843fbdf7e8174bb6f65 # Parent 00a848ede42dd85a22e2ccbdc9afedfbf4e99271 mod_http_muc_log: Allow specifying the default view diff -r 00a848ede42d -r 6e529f53b3c3 mod_http_muc_log/README.markdown --- a/mod_http_muc_log/README.markdown Mon May 13 11:13:19 2019 +0200 +++ b/mod_http_muc_log/README.markdown Mon May 13 00:52:35 2019 +0200 @@ -50,6 +50,15 @@ for rendering templates, with the pattern `"%b{}"` and HTML / XML escaping enabled. +## Default view + +To link to the latest day instead of calendar from the room listing +page: + +```lua +http_muc_log_default_view = "latest" +``` + ## Inline images Inline images can optionally be shown. This is disabled by default for diff -r 00a848ede42d -r 6e529f53b3c3 mod_http_muc_log/mod_http_muc_log.lua --- a/mod_http_muc_log/mod_http_muc_log.lua Mon May 13 11:13:19 2019 +0200 +++ b/mod_http_muc_log/mod_http_muc_log.lua Mon May 13 00:52:35 2019 +0200 @@ -96,11 +96,14 @@ return true; end +-- Can be set to "latest" +local default_view = module:get_option_string(module.name .. "_default_view", nil); + module:hook("muc-disco#info", function (event) local room = event.room; if open_room(room) then table.insert(event.form, { name = "muc#roominfo_logs", type="text-single" }); - event.formdata["muc#roominfo_logs"] = get_absolute_link(jid_split(event.room.jid), nil); + event.formdata["muc#roominfo_logs"] = get_absolute_link(jid_split(event.room.jid), default_view); end end); @@ -371,7 +374,7 @@ if not (room.get_hidden or room.is_hidden)(room) then room_list[i], i = { jid = room.jid; - href = get_link(jid_split(room.jid), nil); + href = get_link(jid_split(room.jid), default_view); name = room:get_name(); description = room:get_description(); }, i + 1;