# HG changeset patch # User Kim Alvefur # Date 1570890174 -7200 # Node ID 0a0bf87ccda636eee83d61ffdd9a887854e992b9 # Parent 309fa523c42445ba7176b5f3b4790054d3c5d0da mod_http_altconnect: Handle connection modules being global or host-local mod_bosh may be either a global or a normal module depending on Prosody version. diff -r 309fa523c424 -r 0a0bf87ccda6 mod_http_altconnect/mod_http_altconnect.lua --- a/mod_http_altconnect/mod_http_altconnect.lua Fri Oct 11 11:02:55 2019 +0200 +++ b/mod_http_altconnect/mod_http_altconnect.lua Sat Oct 12 16:22:54 2019 +0200 @@ -3,18 +3,17 @@ module:depends"http"; +local mm = require "core.modulemanager"; local json = require"util.json"; local st = require"util.stanza"; local array = require"util.array"; -local host_modules = hosts[module.host].modules; - local function get_supported() local uris = array(); - if host_modules["bosh"] then + if mm.is_loaded(module.host, "bosh") or mm.is_loaded("*", "bosh") then uris:push({ rel = "urn:xmpp:alt-connections:xbosh", href = module:http_url("bosh", "/http-bind") }); end - if host_modules["websocket"] then + if mm.is_loaded(module.host, "websocket") or mm.is_loaded("*", "websocket") then uris:push({ rel = "urn:xmpp:alt-connections:websocket", href = module:http_url("websocket", "xmpp-websocket"):gsub("^http", "ws") }); end return uris;