Comparison

plugins/mod_bosh.lua @ 2959:62a3f824292a

mod_bosh: Default stanza namespace should be jabber:client (fixes BOSH to work with recent namespace fix)
author Matthew Wild <mwild1@gmail.com>
date Sat, 03 Apr 2010 22:24:39 +0100
parent 2923:b7049746bd29
child 2961:db3c0ecce3f4
child 3039:2fef108d7eb7
comparison
equal deleted inserted replaced
2950:0250fba6be72 2959:62a3f824292a
21 local st = require "util.stanza"; 21 local st = require "util.stanza";
22 local logger = require "util.logger"; 22 local logger = require "util.logger";
23 local log = logger.init("mod_bosh"); 23 local log = logger.init("mod_bosh");
24 24
25 local xmlns_bosh = "http://jabber.org/protocol/httpbind"; -- (hard-coded into a literal in session.send) 25 local xmlns_bosh = "http://jabber.org/protocol/httpbind"; -- (hard-coded into a literal in session.send)
26 local stream_callbacks = { stream_tag = "http://jabber.org/protocol/httpbind\1body", default_ns = xmlns_bosh }; 26 local stream_callbacks = { stream_tag = "http://jabber.org/protocol/httpbind\1body", default_ns = "jabber:client" };
27 27
28 local BOSH_DEFAULT_HOLD = tonumber(module:get_option("bosh_default_hold")) or 1; 28 local BOSH_DEFAULT_HOLD = tonumber(module:get_option("bosh_default_hold")) or 1;
29 local BOSH_DEFAULT_INACTIVITY = tonumber(module:get_option("bosh_max_inactivity")) or 60; 29 local BOSH_DEFAULT_INACTIVITY = tonumber(module:get_option("bosh_max_inactivity")) or 60;
30 local BOSH_DEFAULT_POLLING = tonumber(module:get_option("bosh_max_polling")) or 5; 30 local BOSH_DEFAULT_POLLING = tonumber(module:get_option("bosh_max_polling")) or 5;
31 local BOSH_DEFAULT_REQUESTS = tonumber(module:get_option("bosh_max_requests")) or 2; 31 local BOSH_DEFAULT_REQUESTS = tonumber(module:get_option("bosh_max_requests")) or 2;
250 function stream_callbacks.handlestanza(request, stanza) 250 function stream_callbacks.handlestanza(request, stanza)
251 log("debug", "BOSH stanza received: %s\n", stanza:top_tag()); 251 log("debug", "BOSH stanza received: %s\n", stanza:top_tag());
252 local session = sessions[request.sid]; 252 local session = sessions[request.sid];
253 if session then 253 if session then
254 if stanza.attr.xmlns == xmlns_bosh then 254 if stanza.attr.xmlns == xmlns_bosh then
255 stanza.attr.xmlns = "jabber:client"; 255 stanza.attr.xmlns = nil;
256 end 256 end
257 session.ip = request.handler.ip(); 257 session.ip = request.handler.ip();
258 core_process_stanza(session, stanza); 258 core_process_stanza(session, stanza);
259 end 259 end
260 end 260 end