Diff

util/stanza.lua @ 9732:51583ea2b4fd

util.stanza: Require a type attribute for iq stanzas
author Kim Alvefur <zash@zash.se>
date Fri, 28 Dec 2018 20:49:01 +0100
parent 9674:6f97acc4583b
child 9924:5a2e53bef031
line wrap: on
line diff
--- a/util/stanza.lua	Mon Dec 24 03:00:27 2018 +0100
+++ b/util/stanza.lua	Fri Dec 28 20:49:01 2018 +0100
@@ -423,9 +423,15 @@
 	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