Software /
code /
prosody
Comparison
util/stanza.lua @ 10443:f28718f46196
util.stanza: Remove redundant check for attrs
A stanza can't not have attrs if created the correct way
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 25 Nov 2019 20:46:55 +0100 |
parent | 10442:22db763c510c |
child | 10444:4eab1f5a4f3b |
comparison
equal
deleted
inserted
replaced
10442:22db763c510c | 10443:f28718f46196 |
---|---|
436 local function reply(orig) | 436 local function reply(orig) |
437 if not is_stanza(orig) then | 437 if not is_stanza(orig) then |
438 error("bad argument to reply: expected stanza, got "..type(orig)); | 438 error("bad argument to reply: expected stanza, got "..type(orig)); |
439 end | 439 end |
440 return new_stanza(orig.name, | 440 return new_stanza(orig.name, |
441 orig.attr and { | 441 { |
442 to = orig.attr.from, | 442 to = orig.attr.from, |
443 from = orig.attr.to, | 443 from = orig.attr.to, |
444 id = orig.attr.id, | 444 id = orig.attr.id, |
445 type = ((orig.name == "iq" and "result") or orig.attr.type) | 445 type = ((orig.name == "iq" and "result") or orig.attr.type) |
446 }); | 446 }); |