Diff

mod_candy/mod_candy.lua @ 2450:36ffe9d11132

mod_candy: Add config option for a list of rooms to join
author Kim Alvefur <zash@zash.se>
date Fri, 20 Jan 2017 01:24:32 +0100
parent 2449:c9372cfac3b7
child 2451:56bab95e57f0
line wrap: on
line diff
--- a/mod_candy/mod_candy.lua	Fri Jan 20 01:09:36 2017 +0100
+++ b/mod_candy/mod_candy.lua	Fri Jan 20 01:24:32 2017 +0100
@@ -6,6 +6,17 @@
 
 local serve = module:depends"http_files".serve;
 
+local candy_rooms = module:get_option_array("candy_rooms");
+
+local function get_autojoin()
+	if candy_rooms then
+		-- Configured room list, if any
+		return candy_rooms;
+	end
+	-- Check out mod_default_bookmarks
+	return true;
+end
+
 local function get_connect_path()
 	if is_module_loaded(module.host, "websocket") then
 		return module:http_url("websocket", "xmpp-websocket"):gsub("^http", "ws");
@@ -25,6 +36,7 @@
 				.."var Prosody = %s;\n")
 					:format(json_encode({
 						connect_path = get_connect_path();
+						autojoin = get_autojoin();
 						version = prosody.version;
 						host = module:get_host();
 						anonymous = module:get_option_string("authentication") == "anonymous";