mod_bosh: Switch to util.xmppstream from xmlhandlers
authorMatthew Wild <mwild1@gmail.com>
Tue, 7 Dec 2010 18:38:22 +0000 (18:38 +0000)
committerMatthew Wild <mwild1@gmail.com>
Tue, 7 Dec 2010 18:38:22 +0000 (18:38 +0000)
plugins/mod_bosh.lua

index 2ea8e0a019f2c231847de2c657a98b63afbc6a90..d346f247c428020d8fbeef02b9b9415c40036780 100644 (file)
@@ -10,7 +10,7 @@ module.host = "*" -- Global module
 
 local hosts = _G.hosts;
 local lxp = require "lxp";
-local init_xmlhandlers = require "core.xmlhandlers"
+local new_xmpp_stream = require "util.xmppstream".new;
 local httpserver = require "net.httpserver";
 local sm = require "core.sessionmanager";
 local sm_destroy_session = sm.destroy_session;
@@ -119,9 +119,10 @@ function handle_request(method, body, request)
        request.log = log;
        request.on_destroy = on_destroy_request;
        
-       local parser = lxp.new(init_xmlhandlers(request, stream_callbacks), "\1");
-       
-       parser:parse(body);
+       local stream = new_xmpp_stream(request, stream_callbacks);
+       -- stream:feed() calls the stream_callbacks, so all stanzas in
+       -- the body are processed in this next line before it returns.
+       stream:feed(body);
        
        local session = sessions[request.sid];
        if session then