changeset 3712:0a0bf87ccda6

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.
author Kim Alvefur <zash@zash.se>
date Sat, 12 Oct 2019 16:22:54 +0200
parents 309fa523c424
children 53fc4b612fb2
files mod_http_altconnect/mod_http_altconnect.lua
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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;