# HG changeset patch # User Matthew Wild # Date 1264966072 0 # Node ID e5254ccd5ef846469d9c0819496116b1bce60c4d # Parent 50d1ba86a9597b7b406e8079c82e27df808092ed util.stanza: stanza.error_reply(): Fix to put the correct namespace on diff -r 50d1ba86a959 -r e5254ccd5ef8 util/stanza.lua --- a/util/stanza.lua Sun Jan 31 18:09:37 2010 +0000 +++ b/util/stanza.lua Sun Jan 31 19:27:52 2010 +0000 @@ -315,13 +315,16 @@ return stanza(orig.name, orig.attr and { to = orig.attr.from, from = orig.attr.to, id = orig.attr.id, type = ((orig.name == "iq" and "result") or orig.attr.type) }); end -function error_reply(orig, type, condition, message) - local t = reply(orig); - t.attr.type = "error"; - t:tag("error", {type = type}) - :tag(condition, {xmlns = "urn:ietf:params:xml:ns:xmpp-stanzas"}):up(); - if (message) then t:tag("text"):text(message):up(); end - return t; -- stanza ready for adding app-specific errors +do + local xmpp_stanzas_attr = { xmlns = xmlns_stanzas }; + function error_reply(orig, type, condition, message) + local t = reply(orig); + t.attr.type = "error"; + t:tag("error", {type = type}) --COMPAT: Some day xmlns:stanzas goes here + :tag(condition, xmpp_stanzas_attr):up(); + if (message) then t:tag("text", xmpp_stanzas_attr):text(message):up(); end + return t; -- stanza ready for adding app-specific errors + end end function presence(attr)