util.error: Default error originator to stanza sender
authorKim Alvefur <zash@zash.se>
Sat, 26 Sep 2020 18:14:10 +0200
changeset 11094 33b6fbdcec88
parent 11093 35d2260644d9
child 11095 4b4b5188492f
util.error: Default error originator to stanza sender The @by attribute is primarily useful for errors caused by intermediate entities.
util/error.lua
--- a/util/error.lua	Sat Sep 26 18:13:27 2020 +0200
+++ b/util/error.lua	Sat Sep 26 18:14:10 2020 +0200
@@ -96,7 +96,8 @@
 	local error_tag = stanza:get_child("error");
 	context = context or {};
 	context.stanza = stanza;
-	context.by = error_tag.attr.by;
+	context.by = error_tag.attr.by or stanza.attr.from;
+
 	return setmetatable({
 		type = error_type or "cancel";
 		condition = condition or "undefined-condition";