Comparison

util/stanza.lua @ 10442:22db763c510c

util.stanza: Check that argument to reply is a stanza
author Kim Alvefur <zash@zash.se>
date Mon, 25 Nov 2019 20:44:05 +0100
parent 10116:4807535b8673
child 10443:f28718f46196
comparison
equal deleted inserted replaced
10441:f2c9abc71f08 10442:22db763c510c
432 end 432 end
433 return new_stanza("iq", attr); 433 return new_stanza("iq", attr);
434 end 434 end
435 435
436 local function reply(orig) 436 local function reply(orig)
437 if not is_stanza(orig) then
438 error("bad argument to reply: expected stanza, got "..type(orig));
439 end
437 return new_stanza(orig.name, 440 return new_stanza(orig.name,
438 orig.attr and { 441 orig.attr and {
439 to = orig.attr.from, 442 to = orig.attr.from,
440 from = orig.attr.to, 443 from = orig.attr.to,
441 id = orig.attr.id, 444 id = orig.attr.id,