Software /
code /
verse
File
libs/xstanza.lua @ 10:3a422606a040
verse.client: Fire events on stream features, errors, etc. and on non-stream tags such as SASL and TLS
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 28 Nov 2009 22:28:03 +0000 |
parent | 6:f8e0ab90d84e |
child | 15:be4154ed4e3a |
line wrap: on
line source
local stanza_mt = getmetatable(require "util.stanza".stanza()); function stanza_mt:error_from_stanza() local type, condition, text; local error_tag = self:get_child("error", "urn:ietf:params:xml:ns:xmpp-stanzas"); if not error_tag then return nil, nil; end type = error.attr.type; for child in error_tag:children() do if child.attr.xmlns == xmlns_stanzas then if child.name == "text" then text = child:get_text(); else condition = child.name; end if condition and text then break; end end end return type, condition, text; end