aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_c2s.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-10-24 15:17:01 +0200
committerKim Alvefur <zash@zash.se>2021-10-24 15:17:01 +0200
commitef6cb64b9edf578685bedc02f72ed27bbc1d974f (patch)
tree42febf7fd157642a1eb3efe3cbd43e5c82d2d86a /plugins/mod_c2s.lua
parent94d9ba7ce14ebd30975f893e37e0defb0aeb080f (diff)
downloadprosody-ef6cb64b9edf578685bedc02f72ed27bbc1d974f.tar.gz
prosody-ef6cb64b9edf578685bedc02f72ed27bbc1d974f.zip
mod_c2s,etc: Identify stanza object with appropriate function
Better than duck typing, in case anyone ever passes a non-stanza table with a 'name' field.
Diffstat (limited to 'plugins/mod_c2s.lua')
-rw-r--r--plugins/mod_c2s.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/plugins/mod_c2s.lua b/plugins/mod_c2s.lua
index e97b3b3f..298acc28 100644
--- a/plugins/mod_c2s.lua
+++ b/plugins/mod_c2s.lua
@@ -194,6 +194,8 @@ local function session_close(session, reason)
local stream_error = st.stanza("stream:error");
if type(reason) == "string" then -- assume stream error
stream_error:tag(reason, {xmlns = 'urn:ietf:params:xml:ns:xmpp-streams' });
+ elseif st.is_stanza(reason) then
+ stream_error = reason;
elseif type(reason) == "table" then
if reason.condition then
stream_error:tag(reason.condition, stream_xmlns_attr):up();
@@ -203,8 +205,6 @@ local function session_close(session, reason)
if reason.extra then
stream_error:add_child(reason.extra);
end
- elseif reason.name then -- a stanza
- stream_error = reason;
end
end
stream_error = tostring(stream_error);