# HG changeset patch # User Kim Alvefur # Date 1574711215 -3600 # Node ID f28718f46196d1f68968193e892fed1c4d1f39ba # Parent 22db763c510cdc0a75a8e8c18a167cc91109a0b0 util.stanza: Remove redundant check for attrs A stanza can't not have attrs if created the correct way diff -r 22db763c510c -r f28718f46196 spec/util_stanza_spec.lua --- a/spec/util_stanza_spec.lua Mon Nov 25 20:44:05 2019 +0100 +++ b/spec/util_stanza_spec.lua Mon Nov 25 20:46:55 2019 +0100 @@ -176,6 +176,13 @@ st.reply(not "a stanza"); end, "expected stanza"); end); + + it("should reject not-stanzas", function () + assert.has.error_match(function () + st.reply({name="x"}); + end, "expected stanza"); + end); + end); describe("#error_reply()", function() diff -r 22db763c510c -r f28718f46196 util/stanza.lua --- a/util/stanza.lua Mon Nov 25 20:44:05 2019 +0100 +++ b/util/stanza.lua Mon Nov 25 20:46:55 2019 +0100 @@ -438,7 +438,7 @@ error("bad argument to reply: expected stanza, got "..type(orig)); end return new_stanza(orig.name, - orig.attr and { + { to = orig.attr.from, from = orig.attr.to, id = orig.attr.id,