From 4e34c40ece0eb19f85720d63b1b0372f59e5616d Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 14 Dec 2019 22:47:41 +0100 Subject: util.stanza: Accept util.error object to error_reply If we're moving towards util.error as the standard error container then this makes sense. This may allow for future extensibility without needing a lot of optional arguments. --- util/stanza.lua | 3 +++ 1 file changed, 3 insertions(+) (limited to 'util/stanza.lua') diff --git a/util/stanza.lua b/util/stanza.lua index 8e46f90f..f5cd5668 100644 --- a/util/stanza.lua +++ b/util/stanza.lua @@ -458,6 +458,9 @@ local function error_reply(orig, error_type, condition, error_message, error_by) 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 -- cgit v1.2.3