Software /
code /
prosody
Comparison
util/stanza.lua @ 2848:b2f367f16eb8
util.stanza: stanza.error_reply(): Fix to put the correct namespace on <text>
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sun, 31 Jan 2010 19:27:52 +0000 |
parent | 2822:511dfd88e14c |
child | 2923:b7049746bd29 |
comparison
equal
deleted
inserted
replaced
2847:a34decf98668 | 2848:b2f367f16eb8 |
---|---|
289 | 289 |
290 function reply(orig) | 290 function reply(orig) |
291 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) }); | 291 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) }); |
292 end | 292 end |
293 | 293 |
294 function error_reply(orig, type, condition, message) | 294 do |
295 local t = reply(orig); | 295 local xmpp_stanzas_attr = { xmlns = xmlns_stanzas }; |
296 t.attr.type = "error"; | 296 function error_reply(orig, type, condition, message) |
297 t:tag("error", {type = type}) | 297 local t = reply(orig); |
298 :tag(condition, {xmlns = "urn:ietf:params:xml:ns:xmpp-stanzas"}):up(); | 298 t.attr.type = "error"; |
299 if (message) then t:tag("text"):text(message):up(); end | 299 t:tag("error", {type = type}) --COMPAT: Some day xmlns:stanzas goes here |
300 return t; -- stanza ready for adding app-specific errors | 300 :tag(condition, xmpp_stanzas_attr):up(); |
301 if (message) then t:tag("text", xmpp_stanzas_attr):text(message):up(); end | |
302 return t; -- stanza ready for adding app-specific errors | |
303 end | |
301 end | 304 end |
302 | 305 |
303 function presence(attr) | 306 function presence(attr) |
304 return stanza("presence", attr); | 307 return stanza("presence", attr); |
305 end | 308 end |