aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2008-10-05 04:55:45 +0500
committerWaqas Hussain <waqas20@gmail.com>2008-10-05 04:55:45 +0500
commit95367859295d23cb6a36079bb3b36caf6bdbd4ed (patch)
tree6daf3116e1d722d1a86c0f769d1317c524c03464 /util
parent5239107016cf58af6ac10d9b8a436b4da2ff130c (diff)
downloadprosody-95367859295d23cb6a36079bb3b36caf6bdbd4ed.tar.gz
prosody-95367859295d23cb6a36079bb3b36caf6bdbd4ed.zip
User registration, etc (jabber:iq:register)
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 553bba4d..cc5b7623 100644
--- a/util/stanza.lua
+++ b/util/stanza.lua
@@ -132,6 +132,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