Software /
code /
prosody
Comparison
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 |
comparison
equal
deleted
inserted
replaced
61:7afc23a8114e | 62:9ec0d447cc9e |
---|---|
121 | 121 |
122 function reply(orig) | 122 function reply(orig) |
123 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) }); | 123 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) }); |
124 end | 124 end |
125 | 125 |
126 function error_reply(orig, type, condition, message, clone) | |
127 local r = reply(orig); | |
128 t.attr.type = "error"; | |
129 -- TODO use clone | |
130 t:tag("error", {type = type}) | |
131 :tag(condition, {xmlns = "urn:ietf:params:xml:ns:xmpp-stanzas"}):up(); | |
132 if (message) then t:tag("text"):text(message):up(); end | |
133 return t; -- stanza ready for adding app-specific errors | |
134 end | |
135 | |
126 function presence(attr) | 136 function presence(attr) |
127 return stanza("presence", attr); | 137 return stanza("presence", attr); |
128 end | 138 end |
129 | 139 |
130 return _M; | 140 return _M; |