16 local xmlns_component = "jabber:component:accept"; |
16 local xmlns_component = "jabber:component:accept"; |
17 |
17 |
18 local stream_callbacks = { |
18 local stream_callbacks = { |
19 stream_ns = xmlns_stream, |
19 stream_ns = xmlns_stream, |
20 stream_tag = "stream", |
20 stream_tag = "stream", |
21 default_ns = "jabber:client" }; |
21 default_ns = xmlns_component }; |
22 |
22 |
23 function stream_callbacks.streamopened(stream, attr) |
23 function stream_callbacks.streamopened(stream, attr) |
24 stream.stream_id = attr.id; |
24 stream.stream_id = attr.id; |
25 if not stream:event("opened", attr) then |
25 if not stream:event("opened", attr) then |
26 stream.notopen = nil; |
26 stream.notopen = nil; |
33 end |
33 end |
34 |
34 |
35 function stream_callbacks.handlestanza(stream, stanza) |
35 function stream_callbacks.handlestanza(stream, stanza) |
36 if stanza.attr.xmlns == xmlns_stream then |
36 if stanza.attr.xmlns == xmlns_stream then |
37 return stream:event("stream-"..stanza.name, stanza); |
37 return stream:event("stream-"..stanza.name, stanza); |
38 elseif stanza.attr.xmlns then |
38 elseif stanza.attr.xmlns or stanza.name == "handshake" then |
39 return stream:event("stream/"..stanza.attr.xmlns, stanza); |
39 return stream:event("stream/"..(stanza.attr.xmlns or xmlns_component), stanza); |
40 end |
40 end |
41 |
41 |
42 return stream:event("stanza", stanza); |
42 return stream:event("stanza", stanza); |
43 end |
43 end |
44 |
44 |