Comparison

core/xmlhandlers.lua @ 99:ba08b8a4eeef

Abstract connections with "connection listeners" - Added connlistener for xmppclient - SASL/TLS now use a new session:reset_stream() method - main.lua on its way to being a bit neater
author Matthew Wild <mwild1@gmail.com>
date Wed, 22 Oct 2008 17:36:21 +0100
parent 53:14ea0fe6ca86
child 145:fbb3a4ff9cf1
child 149:40e443eacbbd
comparison
equal deleted inserted replaced
98:3a2d327c4856 99:ba08b8a4eeef
1 1
2 local sessionmanager_streamopened = require "core.sessionmanager".streamopened;
3 require "util.stanza" 2 require "util.stanza"
4 3
5 local st = stanza; 4 local st = stanza;
6 local tostring = tostring; 5 local tostring = tostring;
7 local format = string.format; 6 local format = string.format;
14 13
15 local error = error; 14 local error = error;
16 15
17 module "xmlhandlers" 16 module "xmlhandlers"
18 17
19 function init_xmlhandlers(session) 18 function init_xmlhandlers(session, streamopened)
20 local ns_stack = { "" }; 19 local ns_stack = { "" };
21 local curr_ns = ""; 20 local curr_ns = "";
22 local curr_tag; 21 local curr_tag;
23 local chardata = {}; 22 local chardata = {};
24 local xml_handlers = {}; 23 local xml_handlers = {};
36 end 35 end
37 curr_ns,name = name:match("^(.+):(%w+)$"); 36 curr_ns,name = name:match("^(.+):(%w+)$");
38 if not stanza then 37 if not stanza then
39 if session.notopen then 38 if session.notopen then
40 if name == "stream" then 39 if name == "stream" then
41 sessionmanager_streamopened(session, attr); 40 streamopened(session, attr);
42 return; 41 return;
43 end 42 end
44 error("Client failed to open stream successfully"); 43 error("Client failed to open stream successfully");
45 end 44 end
46 if curr_ns == "jabber:client" and name ~= "iq" and name ~= "presence" and name ~= "message" then 45 if curr_ns == "jabber:client" and name ~= "iq" and name ~= "presence" and name ~= "message" then