Software / code / verse
Comparison
component.lua @ 150:728cc7f2f0c2
verse.component: Namespacing fixes
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Tue, 09 Nov 2010 19:57:52 +0000 |
| parent | 84:d85d2443478e |
| child | 161:b177bcea2006 |
comparison
equal
deleted
inserted
replaced
| 149:f5c524412939 | 150:728cc7f2f0c2 |
|---|---|
| 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 |