comparison mod_smacks/mod_smacks.lua @ 592:f9c73c1249cd

Update smacks to urn:xmpp:sm:3. Fix typo in can_do_smacks.
author Thijs Alkemade <thijsalkemade@gmail.com>
date Thu, 02 Feb 2012 01:23:00 +0100
parents 36003cae2370
children db2a40cbd6ef
comparison
equal deleted inserted replaced
591:36003cae2370 592:f9c73c1249cd
6 local os_time = os.time; 6 local os_time = os.time;
7 local tonumber, tostring = tonumber, tostring; 7 local tonumber, tostring = tonumber, tostring;
8 local add_filter = require "util.filters".add_filter; 8 local add_filter = require "util.filters".add_filter;
9 local timer = require "util.timer"; 9 local timer = require "util.timer";
10 10
11 local xmlns_sm = "urn:xmpp:sm:2"; 11 local xmlns_sm = "urn:xmpp:sm:3";
12 local xmlns_errors = "urn:ietf:params:xml:ns:xmpp-stanzas"; 12 local xmlns_errors = "urn:ietf:params:xml:ns:xmpp-stanzas";
13 13
14 local sm_attr = { xmlns = xmlns_sm }; 14 local sm_attr = { xmlns = xmlns_sm };
15 15
16 local resume_timeout = module:get_option("smacks_hibernation_time", 300); 16 local resume_timeout = module:get_option("smacks_hibernation_time", 300);
23 if session.smacks then return false, "unexpected-request", "Stream management is already enabled"; end 23 if session.smacks then return false, "unexpected-request", "Stream management is already enabled"; end
24 24
25 local session_type = session.type; 25 local session_type = session.type;
26 if type == "c2s" then 26 if type == "c2s" then
27 if not(advertise_only) and not(session.resource) then -- Fail unless we're only advertising sm 27 if not(advertise_only) and not(session.resource) then -- Fail unless we're only advertising sm
28 return false, "unexpected-request", "Client must bind a resource before enabling stream management"; end 28 return false, "unexpected-request", "Client must bind a resource before enabling stream management";
29 end 29 end
30 return true; 30 return true;
31 elseif s2s_smacks and (type == "s2sin" or type == "s2sout") then 31 elseif s2s_smacks and (type == "s2sin" or type == "s2sout") then
32 return true; 32 return true;
33 end 33 end