aboutsummaryrefslogtreecommitdiffstats
path: root/util/xmppstream.lua
diff options
context:
space:
mode:
Diffstat (limited to 'util/xmppstream.lua')
-rw-r--r--util/xmppstream.lua13
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;