--- 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
=============
--- 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";
--- 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/' }
});