aboutsummaryrefslogtreecommitdiffstats
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
commite1a8c869705c9e2af9850714b1c08dd24fb36e22 (patch)
tree2dfd7583a50d605236ad8831b3e8d0dd0aba3848
parentbc402832aa9104f0f21a406218b79e0be0c47b73 (diff)
downloadprosody-e1a8c869705c9e2af9850714b1c08dd24fb36e22.tar.gz
prosody-e1a8c869705c9e2af9850714b1c08dd24fb36e22.zip
util.stanza: stanza.error_reply(): Fix to put the correct namespace on <text>
-rw-r--r--util/stanza.lua17
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)