Mercurial > prosody-hg
comparison plugins/mod_bosh.lua @ 2961:db3c0ecce3f4
Merge 0.6->0.7
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Sat, 03 Apr 2010 23:09:11 +0100 |
| parents | 692b3c6c5bd2 62a3f824292a |
| children | 1fadbb2e3ca0 |
comparison
equal
deleted
inserted
replaced
| 2953:3cafa20e22e9 | 2961:db3c0ecce3f4 |
|---|---|
| 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_ns = "http://jabber.org/protocol/httpbind", stream_tag = "body", default_ns = xmlns_bosh }; | 26 local stream_callbacks = { stream_ns = "http://jabber.org/protocol/httpbind", stream_tag = "body", 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; |
| 272 function stream_callbacks.handlestanza(request, stanza) | 272 function stream_callbacks.handlestanza(request, stanza) |
| 273 log("debug", "BOSH stanza received: %s\n", stanza:top_tag()); | 273 log("debug", "BOSH stanza received: %s\n", stanza:top_tag()); |
| 274 local session = sessions[request.sid]; | 274 local session = sessions[request.sid]; |
| 275 if session then | 275 if session then |
| 276 if stanza.attr.xmlns == xmlns_bosh then | 276 if stanza.attr.xmlns == xmlns_bosh then |
| 277 stanza.attr.xmlns = "jabber:client"; | 277 stanza.attr.xmlns = nil; |
| 278 end | 278 end |
| 279 session.ip = request.handler:ip(); | 279 session.ip = request.handler:ip(); |
| 280 core_process_stanza(session, stanza); | 280 core_process_stanza(session, stanza); |
| 281 end | 281 end |
| 282 end | 282 end |
