# HG changeset patch # User Kim Alvefur # Date 1484871872 -3600 # Node ID 36ffe9d1113232efe41aa4fd0bb019d9c6828b50 # Parent c9372cfac3b771129afc26191d5e7b64f76a26d4 mod_candy: Add config option for a list of rooms to join diff -r c9372cfac3b7 -r 36ffe9d11132 mod_candy/README.markdown --- a/mod_candy/README.markdown Fri Jan 20 01:09:36 2017 +0100 +++ b/mod_candy/README.markdown Fri Jan 20 01:24:32 2017 +0100 @@ -30,8 +30,10 @@ After the module has been loaded, Candy will by default be reachable from `http://example.com:5280/candy/` -It may be helpful to also enable [mod\_default\_bookmarks] so that Candy -users always have some room(s) to join, or it will show an empty screen. +You can configure what rooms to join using either `candy_rooms` (an +array) or [mod\_default\_bookmarks]. By default, Candy will attempt to +join rooms that the current user has bookmarked. If there are no rooms +to join, then Candy will show an emtpy screen. Compatibility ============= diff -r c9372cfac3b7 -r 36ffe9d11132 mod_candy/mod_candy.lua --- 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"; diff -r c9372cfac3b7 -r 36ffe9d11132 mod_candy/www_files/index.html --- a/mod_candy/www_files/index.html Fri Jan 20 01:09:36 2017 +0100 +++ b/mod_candy/www_files/index.html Fri Jan 20 01:24:32 2017 +0100 @@ -22,7 +22,7 @@ // -> fetch info from server (NOTE: does only work with openfire server) // ['test@conference.example.com'] // -> array of rooms to join after connecting - autojoin: true + autojoin: Prosody.autojoin }, view: { assets: 'res/' } });