Mon, 29 Apr 2013 10:58:40 +0200
verse.client: Fire stream error events, so they can be handled
client.lua | file | annotate | diff | comparison | revisions |
--- a/client.lua Fri Feb 15 20:45:31 2013 +0100 +++ b/client.lua Mon Apr 29 10:58:40 2013 +0200 @@ -51,6 +51,14 @@ return stream:event("stanza", stanza); end +function stream_callbacks.error(stream, e, stanza) + if stream:event(e, stanza) == nil then + local err = stanza:get_child(nil, "urn:ietf:params:xml:ns:xmpp-streams"); + local text = stanza:get_child_text("text", "urn:ietf:params:xml:ns:xmpp-streams"); + error(err.name..(text and ": "..text)); + end +end + function stream:reset() if self.stream then self.stream:reset();