Changeset

11082:c26599a78fae

util.stanza: Reorder code to prepare for extracting 'by' from util.error
author Kim Alvefur <zash@zash.se>
date Sat, 26 Sep 2020 17:18:17 +0200
parents 11081:0b68697450c5
children 11083:4d12a6785531
files util/stanza.lua
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/util/stanza.lua	Sat Sep 26 17:16:34 2020 +0200
+++ b/util/stanza.lua	Sat Sep 26 17:18:17 2020 +0200
@@ -455,12 +455,12 @@
 	end
 	local t = reply(orig);
 	t.attr.type = "error";
+	if type(error_type) == "table" then -- an util.error or similar object
+		error_type, condition, error_message = error_type.type, error_type.condition, error_type.text;
+	end
 	if t.attr.from == error_by then
 		error_by = nil;
 	end
-	if type(error_type) == "table" then -- an util.error or similar object
-		error_type, condition, error_message = error_type.type, error_type.condition, error_type.text;
-	end
 	t:tag("error", {type = error_type, by = error_by}) --COMPAT: Some day xmlns:stanzas goes here
 	:tag(condition, xmpp_stanzas_attr):up();
 	if error_message then t:text_tag("text", error_message, xmpp_stanzas_attr); end