Software /
code /
prosody
Diff
util/stanza.lua @ 62:9ec0d447cc9e
Merged mod_InBandRegistration from waqas
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sun, 05 Oct 2008 01:32:43 +0100 |
parent | 58:85a93adef6f6 |
parent | 60:44800be871f5 |
child | 70:a6c00467a3f8 |
line wrap: on
line diff
--- a/util/stanza.lua Sun Oct 05 01:31:27 2008 +0100 +++ b/util/stanza.lua Sun Oct 05 01:32:43 2008 +0100 @@ -123,6 +123,16 @@ 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