diff options
author | Matthew Wild <mwild1@gmail.com> | 2010-03-22 16:55:10 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2010-03-22 16:55:10 +0000 |
commit | 2c597f0fa443131956fd7e9d3ad86774f1dd7c7b (patch) | |
tree | 05428140bb6a6647e253bcc9fbd74ead0ef5bda4 /util | |
parent | 1f06159ffaa017bcdd4b2e55b64e05784c708c7b (diff) | |
download | prosody-2c597f0fa443131956fd7e9d3ad86774f1dd7c7b.tar.gz prosody-2c597f0fa443131956fd7e9d3ad86774f1dd7c7b.zip |
util.xmppstream: new() now returns a parser object
Diffstat (limited to 'util')
-rw-r--r-- | util/xmppstream.lua | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/util/xmppstream.lua b/util/xmppstream.lua index a32bcdac..a0be4a8e 100644 --- a/util/xmppstream.lua +++ b/util/xmppstream.lua @@ -7,10 +7,9 @@ -- +local lxp = require "lxp"; +local st = require "util.stanza"; -require "util.stanza" - -local st = stanza; local tostring = tostring; local t_insert = table.insert; local t_concat = table.concat; @@ -21,6 +20,8 @@ local error = error; module "xmppstream" +local new_parser = lxp.new; + local ns_prefixes = { ["http://www.w3.org/XML/1998/namespace"] = "xml"; }; @@ -30,7 +31,7 @@ local xmlns_streams = "http://etherx.jabber.org/streams"; local ns_separator = "\1"; local ns_pattern = "^([^"..ns_separator.."]*)"..ns_separator.."?(.*)$"; -function new(session, stream_callbacks) +function new_sax_handlers(session, stream_callbacks) local chardata = {}; local xml_handlers = {}; local log = session.log or default_log; @@ -142,4 +143,8 @@ function new(session, stream_callbacks) return xml_handlers; end +function new(session, stream_callbacks) + return new_parser(new_sax_handlers(session, stream_callbacks), ns_separator); +end + return _M; |