82 local user_options = module:get_option("conversejs_options"); |
82 local user_options = module:get_option("conversejs_options"); |
83 |
83 |
84 local function get_converse_options() |
84 local function get_converse_options() |
85 local allow_registration = module:get_option_boolean("allow_registration", false); |
85 local allow_registration = module:get_option_boolean("allow_registration", false); |
86 local converse_options = { |
86 local converse_options = { |
|
87 -- Auto-detected connection endpoints |
87 bosh_service_url = has_bosh and module:http_url("bosh","/http-bind") or nil; |
88 bosh_service_url = has_bosh and module:http_url("bosh","/http-bind") or nil; |
88 websocket_url = has_ws and module:http_url("websocket","xmpp-websocket"):gsub("^http", "ws") or nil; |
89 websocket_url = has_ws and module:http_url("websocket","xmpp-websocket"):gsub("^http", "ws") or nil; |
|
90 -- Since we provide those, XEP-0156 based auto-discovery should not be used |
|
91 discover_connection_methods = false; |
|
92 -- Authentication mode to use (normal or guest login) |
89 authentication = module:get_option_string("authentication") == "anonymous" and "anonymous" or "login"; |
93 authentication = module:get_option_string("authentication") == "anonymous" and "anonymous" or "login"; |
90 discover_connection_methods = false; |
94 -- Host to connect to for anonymous access |
91 jid = module.host; |
95 jid = module.host; |
|
96 -- Let users login with only username |
92 default_domain = module.host; |
97 default_domain = module.host; |
93 domain_placeholder = module.host; |
98 domain_placeholder = module.host; |
|
99 -- If registration is enabled |
94 allow_registration = allow_registration; |
100 allow_registration = allow_registration; |
|
101 -- and if it is, which domain to register with |
95 registration_domain = allow_registration and module.host or nil; |
102 registration_domain = allow_registration and module.host or nil; |
|
103 -- Path to resources like emoji, icons, sounds |
96 assets_path = cdn_url..version.."/dist/"; |
104 assets_path = cdn_url..version.."/dist/"; |
|
105 -- Default most suited for use as a "normal" client |
97 view_mode = "fullscreen"; |
106 view_mode = "fullscreen"; |
98 }; |
107 }; |
99 |
108 |
|
109 -- Let config override the above defaults |
100 if type(user_options) == "table" then |
110 if type(user_options) == "table" then |
101 for k,v in pairs(user_options) do |
111 for k,v in pairs(user_options) do |
102 converse_options[k] = v; |
112 converse_options[k] = v; |
103 end |
113 end |
104 end |
114 end |