diff options
author | Matthew Wild <mwild1@gmail.com> | 2010-12-07 18:18:11 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2010-12-07 18:18:11 +0000 |
commit | 0bd9d5abf41d797cabe9fa5c374d0e29f97209c3 (patch) | |
tree | ad1191f24f94efb18e1617b2d84a42ceab7626c8 /net | |
parent | d526ad02d79ffae2c100d1018c9a928aa78c498f (diff) | |
download | prosody-0bd9d5abf41d797cabe9fa5c374d0e29f97209c3.tar.gz prosody-0bd9d5abf41d797cabe9fa5c374d0e29f97209c3.zip |
xmppcomponent_listener: Switch to util.xmppstream from xmlhandlers
Diffstat (limited to 'net')
-rw-r--r-- | net/xmppcomponent_listener.lua | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/net/xmppcomponent_listener.lua b/net/xmppcomponent_listener.lua index 1278f337..3ffa4ba4 100644 --- a/net/xmppcomponent_listener.lua +++ b/net/xmppcomponent_listener.lua @@ -19,7 +19,7 @@ local uuid_gen = require "util.uuid".generate; local jid_split = require "util.jid".split; local sha1 = require "util.hashes".sha1; local st = require "util.stanza"; -local init_xmlhandlers = require "core.xmlhandlers"; +local new_xmpp_stream = require "util.xmppstream".new; local sessions = {}; @@ -29,7 +29,7 @@ local component_listener = { default_port = 5347; default_mode = "*a"; default_i local xmlns_component = 'jabber:component:accept'; ---- Callbacks/data for xmlhandlers to handle streams for us --- +--- Callbacks/data for xmppstream to handle streams for us --- local stream_callbacks = { default_ns = xmlns_component }; @@ -177,13 +177,18 @@ function component_listener.onincoming(conn, data) session.log("info", "Incoming Jabber component connection"); - local parser = lxp.new(init_xmlhandlers(session, stream_callbacks), "\1"); - session.parser = parser; + local stream = new_xmpp_stream(session, stream_callbacks); + session.stream = stream; session.notopen = true; + function session.reset_stream() + session.notopen = true; + session.stream:reset(); + end + function session.data(conn, data) - local ok, err = parser:parse(data); + local ok, err = stream:feed(data); if ok then return; end log("debug", "Received invalid XML (%s) %d bytes: %s", tostring(err), #data, data:sub(1, 300):gsub("[\r\n]+", " "):gsub("[%z\1-\31]", "_")); session:close("not-well-formed"); |