51 return stream:event("stanza", stanza); |
51 return stream:event("stanza", stanza); |
52 end |
52 end |
53 |
53 |
54 function stream_callbacks.error(stream, e, stanza) |
54 function stream_callbacks.error(stream, e, stanza) |
55 if stream:event(e, stanza) == nil then |
55 if stream:event(e, stanza) == nil then |
56 local err = stanza:get_child(nil, "urn:ietf:params:xml:ns:xmpp-streams"); |
56 if stanza then |
57 local text = stanza:get_child_text("text", "urn:ietf:params:xml:ns:xmpp-streams"); |
57 local err = stanza:get_child(nil, "urn:ietf:params:xml:ns:xmpp-streams"); |
58 error(err.name..(text and ": "..text or "")); |
58 local text = stanza:get_child_text("text", "urn:ietf:params:xml:ns:xmpp-streams"); |
|
59 error(err.name..(text and ": "..text or "")); |
|
60 else |
|
61 error(stanza and stanza.name or e or "unknown-error"); |
|
62 end |
59 end |
63 end |
60 end |
64 end |
61 |
65 |
62 function stream:reset() |
66 function stream:reset() |
63 if self.stream then |
67 if self.stream then |