comparison 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
parents c84ff82658cb
children b21236b6b8d8
comparison
equal deleted inserted replaced
1323:c84ff82658cb 1324:853a382c9bd6
4 module:depends"http"; 4 module:depends"http";
5 5
6 local json = require"util.json"; 6 local json = require"util.json";
7 local st = require"util.stanza"; 7 local st = require"util.stanza";
8 local array = require"util.array"; 8 local array = require"util.array";
9 local it = require"util.iterators";
9 10
10 local host_modules = hosts[module.host].modules; 11 local host_modules = hosts[module.host].modules;
11 12
12 local function get_supported() 13 local function get_supported()
13 local uris = array(); 14 local uris = array(it.values(module:get_host_items("alt-conn-method")));
14 if host_modules["bosh"] then 15 if #uris == 0 then
15 uris:push({ rel = "urn:xmpp:alt-connections:xbosh", href = module:http_url("bosh", "/http-bind") }); 16 -- COMPAT for with before item array was added
16 end 17 if host_modules["bosh"] then
17 if host_modules["websocket"] then 18 uris:push({ rel = "urn:xmpp:alt-connections:xbosh", href = module:http_url("bosh", "/http-bind") });
18 uris:push({ rel = "urn:xmpp:alt-connections:websocket", href = module:http_url("websocket", "xmpp-websocket"):gsub("^http", "ws") }); 19 end
20 if host_modules["websocket"] then
21 uris:push({ rel = "urn:xmpp:alt-connections:websocket", href = module:http_url("websocket", "xmpp-websocket"):gsub("^http", "ws") });
22 end
19 end 23 end
20 return uris; 24 return uris;
21 end 25 end
22 26
23 27