diff options
author | Kim Alvefur <zash@zash.se> | 2020-09-26 17:30:47 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2020-09-26 17:30:47 +0200 |
commit | 10f82d332163c8a3572ee507e32611d56e930ca4 (patch) | |
tree | 8ce8d230407f3e6ea9bdb3896fba6e539779c643 /util/stanza.lua | |
parent | 27273548aec77ac761a23426a31a089283506750 (diff) | |
download | prosody-10f82d332163c8a3572ee507e32611d56e930ca4.tar.gz prosody-10f82d332163c8a3572ee507e32611d56e930ca4.zip |
util.stanza: Support inclusion of <gone> URI from util.error object
Diffstat (limited to 'util/stanza.lua')
-rw-r--r-- | util/stanza.lua | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/util/stanza.lua b/util/stanza.lua index 3c415f20..2c936a40 100644 --- a/util/stanza.lua +++ b/util/stanza.lua @@ -455,9 +455,11 @@ local function error_reply(orig, error_type, condition, error_message, error_by) end local t = reply(orig); t.attr.type = "error"; + local extra; if type(error_type) == "table" then -- an util.error or similar object if type(error_type.extra) == "table" then - if type(error_type.extra.by) == "string" then error_by = error_type.extra.by; end + extra = error_type.extra; + if type(extra.by) == "string" then error_by = extra.by; end end error_type, condition, error_message = error_type.type, error_type.condition, error_type.text; end @@ -465,7 +467,11 @@ local function error_reply(orig, error_type, condition, error_message, error_by) error_by = nil; end t:tag("error", {type = error_type, by = error_by}) --COMPAT: Some day xmlns:stanzas goes here - :tag(condition, xmpp_stanzas_attr):up(); + :tag(condition, xmpp_stanzas_attr); + if extra and condition == "gone" and type(extra.uri) == "string" then + t:text(extra.uri); + end + t:up(); if error_message then t:text_tag("text", error_message, xmpp_stanzas_attr); end return t; -- stanza ready for adding app-specific errors end |