# HG changeset patch # User Kim Alvefur # Date 1540577236 -7200 # Node ID 2681f74750b27697eda8a96a83e45a2ced8a8a28 # Parent af085e8b9d48e4474fa3ba2af05d7ba4008f105f 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. diff -r af085e8b9d48 -r 2681f74750b2 mod_conversejs/mod_conversejs.lua --- 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;