aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-12-28 20:49:01 +0100
committerKim Alvefur <zash@zash.se>2018-12-28 20:49:01 +0100
commitb250ff0d70b614a5ee0025fc68f175428bfca4b5 (patch)
treedf9a77b8e29ec164d9b9d8b877c42d141342e529 /util
parent321a68c41995de92e3002c48c7df8571343dfd54 (diff)
downloadprosody-b250ff0d70b614a5ee0025fc68f175428bfca4b5.tar.gz
prosody-b250ff0d70b614a5ee0025fc68f175428bfca4b5.zip
util.stanza: Require a type attribute for iq stanzas
Diffstat (limited to 'util')
-rw-r--r--util/stanza.lua8
1 files changed, 7 insertions, 1 deletions
diff --git a/util/stanza.lua b/util/stanza.lua
index a90d56b3..e9847ca6 100644
--- a/util/stanza.lua
+++ b/util/stanza.lua
@@ -423,9 +423,15 @@ local function message(attr, body)
end
end
local function iq(attr)
- if not (attr and attr.id) then
+ if not attr then
+ error("iq stanzas require id and type attributes");
+ end
+ if not attr.id then
error("iq stanzas require an id attribute");
end
+ if not attr.type then
+ error("iq stanzas require a type attribute");
+ end
return new_stanza("iq", attr);
end