aboutsummaryrefslogtreecommitdiffstats
path: root/util/stanza.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2010-01-31 19:27:52 +0000
committerMatthew Wild <mwild1@gmail.com>2010-01-31 19:27:52 +0000
commit9ed7624f754479dfb78d90a5367678567424a03b (patch)
treeace725a949a8e7af6ee6f46e13652085f3684d56 /util/stanza.lua
parent4dbc6b605d93a998517eb96c4bae43038199d75a (diff)
downloadprosody-9ed7624f754479dfb78d90a5367678567424a03b.tar.gz
prosody-9ed7624f754479dfb78d90a5367678567424a03b.zip
util.stanza: stanza.error_reply(): Fix to put the correct namespace on <text>
Diffstat (limited to 'util/stanza.lua')
-rw-r--r--util/stanza.lua17
1 files changed, 10 insertions, 7 deletions
diff --git a/util/stanza.lua b/util/stanza.lua
index 8d3b7747..069daa53 100644
--- a/util/stanza.lua
+++ b/util/stanza.lua
@@ -291,13 +291,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)