test_xmppstream.lua

Wed, 05 Jan 2011 03:03:40 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Wed, 05 Jan 2011 03:03:40 +0000
changeset 3997
ed70d20fc133
parent 3993
cbfa0ea6668b
permissions
-rw-r--r--

mod_saslauth: Use get_text() instead of directly accessing stanza child text nodes

local xmppstream = require "util.xmppstream";

local session = { notopen = true };

local callbacks = {
	stream_tag = "stream"; stream_ns = "";
	streamopened = function (session, attr)
		print("Stream opened!");
		session.notopen = nil;
	end;
	handlestanza = function (session, stanza)
		print("Received stanza:", stanza);
	end;
	streamclosed = function (session)
		print("Stream closed!");
	end;
};

local stream = xmppstream.new(session, callbacks);

stream:feed[[
<stream>
	<message foo="bar">
	]]
stream:feed[[
		<body>Hi there!</body>
	</message>
</stream>
]]

mercurial