Diff

util/stanza.lua @ 11086:2846b6226a8e

util.stanza: Support Application-Specific Conditions in util.error
author Kim Alvefur <zash@zash.se>
date Sat, 26 Sep 2020 18:09:10 +0200
parent 11085:5705d151ea11
child 11088:1f84d0e4d0c4
line wrap: on
line diff
--- a/util/stanza.lua	Sat Sep 26 18:07:33 2020 +0200
+++ b/util/stanza.lua	Sat Sep 26 18:09:10 2020 +0200
@@ -473,6 +473,11 @@
 	end
 	t:up();
 	if error_message then t:text_tag("text", error_message, xmpp_stanzas_attr); end
+	if extra and is_stanza(extra.tag) then
+		t:add_child(extra.tag);
+	elseif extra and extra.namespace and extra.condition then
+		t:tag(extra.condition, { xmlns = extra.namespace }):up();
+	end
 	return t; -- stanza ready for adding app-specific errors
 end