6 local st = require "util.stanza"; |
6 local st = require "util.stanza"; |
7 local init_xmlhandlers = require "xmlhandlers"; |
7 local init_xmlhandlers = require "xmlhandlers"; |
8 |
8 |
9 local xmlns_stream = "http://etherx.jabber.org/streams"; |
9 local xmlns_stream = "http://etherx.jabber.org/streams"; |
10 |
10 |
11 local stream_callbacks = { stream_tag = xmlns_stream.."|stream", |
11 local stream_callbacks = { stream_tag = xmlns_stream.."\1stream", |
12 default_ns = "jabber:client" }; |
12 default_ns = "jabber:client" }; |
13 |
13 |
14 function stream_callbacks.streamopened(stream, attr) |
14 function stream_callbacks.streamopened(stream, attr) |
15 if not stream:event("opened") then |
15 if not stream:event("opened") then |
16 stream.notopen = nil; |
16 stream.notopen = nil; |
31 return stream:event("stanza", stanza); |
31 return stream:event("stanza", stanza); |
32 end |
32 end |
33 |
33 |
34 local function reset_stream(stream) |
34 local function reset_stream(stream) |
35 -- Reset stream |
35 -- Reset stream |
36 local parser = lxp.new(init_xmlhandlers(stream, stream_callbacks), "|"); |
36 local parser = lxp.new(init_xmlhandlers(stream, stream_callbacks), "\1"); |
37 stream.parser = parser; |
37 stream.parser = parser; |
38 |
38 |
39 stream.notopen = true; |
39 stream.notopen = true; |
40 |
40 |
41 function stream.data(conn, data) |
41 function stream.data(conn, data) |