aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-11-25 20:46:55 +0100
committerKim Alvefur <zash@zash.se>2019-11-25 20:46:55 +0100
commit7fdb06225efa628956ee38d944bd45d811bac358 (patch)
tree09b44781b668b0bdc6ec729d5979680a65ce0839
parentb9875e5501fe7ab32465e4677a9f35b064be5099 (diff)
downloadprosody-7fdb06225efa628956ee38d944bd45d811bac358.tar.gz
prosody-7fdb06225efa628956ee38d944bd45d811bac358.zip
util.stanza: Remove redundant check for attrs
A stanza can't not have attrs if created the correct way
-rw-r--r--spec/util_stanza_spec.lua7
-rw-r--r--util/stanza.lua2
2 files changed, 8 insertions, 1 deletions
diff --git a/spec/util_stanza_spec.lua b/spec/util_stanza_spec.lua
index 7d710888..3b9084fa 100644
--- a/spec/util_stanza_spec.lua
+++ b/spec/util_stanza_spec.lua
@@ -176,6 +176,13 @@ describe("util.stanza", function()
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 --git a/util/stanza.lua b/util/stanza.lua
index f46d5b30..919d983c 100644
--- a/util/stanza.lua
+++ b/util/stanza.lua
@@ -438,7 +438,7 @@ local function reply(orig)
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,