Software /
code /
verse
Comparison
client.lua @ 336:658c62c9ecc4
verse.client: Fire stream error events, so they can be handled
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 29 Apr 2013 10:58:40 +0200 |
parent | 329:2787e038bea2 |
child | 344:ea668c47e1bd |
comparison
equal
deleted
inserted
replaced
335:9e69ee8542d4 | 336:658c62c9ecc4 |
---|---|
47 elseif stanza.attr.xmlns then | 47 elseif stanza.attr.xmlns then |
48 return stream:event("stream/"..stanza.attr.xmlns, stanza); | 48 return stream:event("stream/"..stanza.attr.xmlns, stanza); |
49 end | 49 end |
50 | 50 |
51 return stream:event("stanza", stanza); | 51 return stream:event("stanza", stanza); |
52 end | |
53 | |
54 function stream_callbacks.error(stream, e, stanza) | |
55 if stream:event(e, stanza) == nil then | |
56 local err = stanza:get_child(nil, "urn:ietf:params:xml:ns:xmpp-streams"); | |
57 local text = stanza:get_child_text("text", "urn:ietf:params:xml:ns:xmpp-streams"); | |
58 error(err.name..(text and ": "..text)); | |
59 end | |
52 end | 60 end |
53 | 61 |
54 function stream:reset() | 62 function stream:reset() |
55 if self.stream then | 63 if self.stream then |
56 self.stream:reset(); | 64 self.stream:reset(); |