From 8f053aedc2be00ba51477dca694d0ff6eb928185 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 26 Sep 2020 18:14:10 +0200 Subject: util.error: Default error originator to stanza sender The @by attribute is primarily useful for errors caused by intermediate entities. --- util/error.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'util') diff --git a/util/error.lua b/util/error.lua index c2b7d149..0fe6cfa2 100644 --- a/util/error.lua +++ b/util/error.lua @@ -96,7 +96,8 @@ local function from_stanza(stanza, context) 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"; -- cgit v1.2.3