Software /
code /
prosody
Comparison
util/stanza.lua @ 209:e9de0803676d
Part one of internal component support
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 04 Nov 2008 18:15:56 +0000 |
parent | 181:d952eae776dc |
child | 242:f15afbcbc55c |
child | 246:0904fd197cbe |
comparison
equal
deleted
inserted
replaced
208:23245a92b275 | 209:e9de0803676d |
---|---|
165 if attr and not attr.id then attr.id = new_id(); end | 165 if attr and not attr.id then attr.id = new_id(); end |
166 return stanza("iq", attr or { id = new_id() }); | 166 return stanza("iq", attr or { id = new_id() }); |
167 end | 167 end |
168 | 168 |
169 function reply(orig) | 169 function reply(orig) |
170 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) }); | 170 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) }); |
171 end | 171 end |
172 | 172 |
173 function error_reply(orig, type, condition, message, clone) | 173 function error_reply(orig, type, condition, message, clone) |
174 local t = reply(orig); | 174 local t = reply(orig); |
175 t.attr.type = "error"; | 175 t.attr.type = "error"; |