Software /
code /
prosody-modules
Diff
mod_http_altconnect/mod_http_altconnect.lua @ 1324:853a382c9bd6
mod_turncredentials: Advertise the XEP-0215 feature (thanks Gryffus)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 28 Feb 2014 15:36:06 +0100 |
parent | 1323:c84ff82658cb |
child | 1325:b21236b6b8d8 |
line wrap: on
line diff
--- a/mod_http_altconnect/mod_http_altconnect.lua Wed Feb 26 13:08:47 2014 -0800 +++ b/mod_http_altconnect/mod_http_altconnect.lua Fri Feb 28 15:36:06 2014 +0100 @@ -6,16 +6,20 @@ local json = require"util.json"; local st = require"util.stanza"; local array = require"util.array"; +local it = require"util.iterators"; local host_modules = hosts[module.host].modules; local function get_supported() - local uris = array(); - if host_modules["bosh"] then - uris:push({ rel = "urn:xmpp:alt-connections:xbosh", href = module:http_url("bosh", "/http-bind") }); - end - if host_modules["websocket"] then - uris:push({ rel = "urn:xmpp:alt-connections:websocket", href = module:http_url("websocket", "xmpp-websocket"):gsub("^http", "ws") }); + local uris = array(it.values(module:get_host_items("alt-conn-method"))); + if #uris == 0 then + -- COMPAT for with before item array was added + if host_modules["bosh"] then + uris:push({ rel = "urn:xmpp:alt-connections:xbosh", href = module:http_url("bosh", "/http-bind") }); + end + if host_modules["websocket"] then + uris:push({ rel = "urn:xmpp:alt-connections:websocket", href = module:http_url("websocket", "xmpp-websocket"):gsub("^http", "ws") }); + end end return uris; end