aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2008-10-05 01:32:43 +0100
committerMatthew Wild <mwild1@gmail.com>2008-10-05 01:32:43 +0100
commit84219ab443bf5c6d19f32d3e64db92c65fecef7f (patch)
treeda65923a6f525661913684b1faacc7759b95fa94 /util
parentc64b4c069eca2147e4296a7cf6ccc3801ea115bc (diff)
parent95367859295d23cb6a36079bb3b36caf6bdbd4ed (diff)
downloadprosody-84219ab443bf5c6d19f32d3e64db92c65fecef7f.tar.gz
prosody-84219ab443bf5c6d19f32d3e64db92c65fecef7f.zip
Merged mod_InBandRegistration from waqas
Diffstat (limited to 'util')
-rw-r--r--util/stanza.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/util/stanza.lua b/util/stanza.lua
index 73f58747..85595664 100644
--- a/util/stanza.lua
+++ b/util/stanza.lua
@@ -123,6 +123,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 nil) });
end
+function error_reply(orig, type, condition, message, clone)
+ local r = reply(orig);
+ t.attr.type = "error";
+ -- TODO use clone
+ 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
+end
+
function presence(attr)
return stanza("presence", attr);
end