util/xmppstream.lua

Mon, 03 Jan 2011 16:46:45 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Mon, 03 Jan 2011 16:46:45 +0000
changeset 3989
692d221ef9bd
parent 3987
8fbf57722368
child 3995
7214dc7a5642
permissions
-rw-r--r--

util.xmppstream: Prepare for using xmllex

-- Prosody IM
-- Copyright (C) 2008-2010 Matthew Wild
-- Copyright (C) 2008-2010 Waqas Hussain
-- 
-- This project is MIT/X11 licensed. Please see the
-- COPYING file in the source package for more information.
--


local lxp = require "lxp";
local lex = require "util.xmllex";
local st = require "util.stanza";
local stanza_mt = st.stanza_mt;

local tostring = tostring;
local t_insert = table.insert;
local t_concat = table.concat;
local t_remove = table.remove;
local setmetatable = setmetatable;

local default_log = require "util.logger".init("xmppstream");

local error = error;

module "xmppstream"

local xmlns_streams = "http://etherx.jabber.org/streams";

function new(session, stream_callbacks)
	local partial;
	
	local function feed(stream, data)
		index(data, 
	end

	return {
		reset = function ()
			parser = new_parser(handlers, ns_separator);
			parse = parser.parse;
			meta.reset();
		end,
		feed = function (self, data)
			return parse(parser, data);
		end,
		set_session = meta.set_session;
	};
end

return _M;

mercurial