diff options
author | Matthew Wild <mwild1@gmail.com> | 2010-01-31 19:27:52 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2010-01-31 19:27:52 +0000 |
commit | e1a8c869705c9e2af9850714b1c08dd24fb36e22 (patch) | |
tree | 2dfd7583a50d605236ad8831b3e8d0dd0aba3848 | |
parent | bc402832aa9104f0f21a406218b79e0be0c47b73 (diff) | |
download | prosody-e1a8c869705c9e2af9850714b1c08dd24fb36e22.tar.gz prosody-e1a8c869705c9e2af9850714b1c08dd24fb36e22.zip |
util.stanza: stanza.error_reply(): Fix to put the correct namespace on <text>
-rw-r--r-- | util/stanza.lua | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/util/stanza.lua b/util/stanza.lua index d223d53f..065888d0 100644 --- a/util/stanza.lua +++ b/util/stanza.lua @@ -315,13 +315,16 @@ function reply(orig) 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) |