Software /
code /
prosody-modules
Changeset
3363:2681f74750b2
mod_conversejs: Weaken dependency on mod_bosh
In trunk after e4c09e335bd9 it will now be possible to set
modules_disabled = { "bosh" }
to prevent it from being loaded.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 26 Oct 2018 20:07:16 +0200 |
parents | 3362:af085e8b9d48 |
children | 3364:264eab9d501c |
files | mod_conversejs/mod_conversejs.lua |
diffstat | 1 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_conversejs/mod_conversejs.lua Thu Oct 25 22:41:13 2018 +0200 +++ b/mod_conversejs/mod_conversejs.lua Fri Oct 26 20:07:16 2018 +0200 @@ -4,7 +4,10 @@ local json_encode = require"util.json".encode; module:depends"http"; -module:depends"bosh"; + +local has_bosh = pcall(function () + module:depends"bosh"; +end); local has_ws = pcall(function () module:depends("websocket"); @@ -58,7 +61,7 @@ local function get_converse_options() local allow_registration = module:get_option_boolean("allow_registration", false); local converse_options = { - bosh_service_url = module:http_url("bosh","/http-bind"); + bosh_service_url = has_bosh and module:http_url("bosh","/http-bind") or nil; websocket_url = has_ws and module:http_url("websocket","xmpp-websocket"):gsub("^http", "ws") or nil; authentication = module:get_option_string("authentication") == "anonymous" and "anonymous" or "login"; jid = module.host;