util.stanza: stanza.error_reply(): Fix to put the correct namespace on <text>
authorMatthew Wild <mwild1@gmail.com>
Sun, 31 Jan 2010 19:27:52 +0000 (19:27 +0000)
committerMatthew Wild <mwild1@gmail.com>
Sun, 31 Jan 2010 19:27:52 +0000 (19:27 +0000)
util/stanza.lua

index 8d3b7747b39dadb50ff73c98dc5bd250f34e7471..069daa53ed7e4546f7b8a2fa4e6b418c757e6de5 100644 (file)
@@ -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)