diff mod_http_muc_log/mod_http_muc_log.lua @ 3596:6e529f53b3c3

mod_http_muc_log: Allow specifying the default view
author Kim Alvefur <zash@zash.se>
date Mon, 13 May 2019 00:52:35 +0200
parents 00a848ede42d
children da7ec4ed6ddf
line wrap: on
line diff
--- 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;