Mercurial > prosody-hg
comparison plugins/mod_bosh.lua @ 3829:8d0f2acbfb28
mod_bosh: Switch to util.xmppstream from xmlhandlers
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Tue, 07 Dec 2010 18:38:22 +0000 |
| parents | bfd72edfd95c |
| children | 926ece7d0e67 |
comparison
equal
deleted
inserted
replaced
| 3828:ccf417c7b5d4 | 3829:8d0f2acbfb28 |
|---|---|
| 8 | 8 |
| 9 module.host = "*" -- Global module | 9 module.host = "*" -- Global module |
| 10 | 10 |
| 11 local hosts = _G.hosts; | 11 local hosts = _G.hosts; |
| 12 local lxp = require "lxp"; | 12 local lxp = require "lxp"; |
| 13 local init_xmlhandlers = require "core.xmlhandlers" | 13 local new_xmpp_stream = require "util.xmppstream".new; |
| 14 local httpserver = require "net.httpserver"; | 14 local httpserver = require "net.httpserver"; |
| 15 local sm = require "core.sessionmanager"; | 15 local sm = require "core.sessionmanager"; |
| 16 local sm_destroy_session = sm.destroy_session; | 16 local sm_destroy_session = sm.destroy_session; |
| 17 local new_uuid = require "util.uuid".generate; | 17 local new_uuid = require "util.uuid".generate; |
| 18 local fire_event = prosody.events.fire_event; | 18 local fire_event = prosody.events.fire_event; |
| 117 --log("debug", "Handling new request %s: %s\n----------", request.id, tostring(body)); | 117 --log("debug", "Handling new request %s: %s\n----------", request.id, tostring(body)); |
| 118 request.notopen = true; | 118 request.notopen = true; |
| 119 request.log = log; | 119 request.log = log; |
| 120 request.on_destroy = on_destroy_request; | 120 request.on_destroy = on_destroy_request; |
| 121 | 121 |
| 122 local parser = lxp.new(init_xmlhandlers(request, stream_callbacks), "\1"); | 122 local stream = new_xmpp_stream(request, stream_callbacks); |
| 123 | 123 -- stream:feed() calls the stream_callbacks, so all stanzas in |
| 124 parser:parse(body); | 124 -- the body are processed in this next line before it returns. |
| 125 stream:feed(body); | |
| 125 | 126 |
| 126 local session = sessions[request.sid]; | 127 local session = sessions[request.sid]; |
| 127 if session then | 128 if session then |
| 128 local r = session.requests; | 129 local r = session.requests; |
| 129 log("debug", "Session %s has %d out of %d requests open", request.sid, #r, session.bosh_hold); | 130 log("debug", "Session %s has %d out of %d requests open", request.sid, #r, session.bosh_hold); |
