Software /
code /
prosody
Diff
plugins/mod_bosh.lua @ 11868:ae093c259da2
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.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 24 Oct 2021 15:17:01 +0200 |
parent | 11808:c24580a214f3 |
child | 12262:50525021c2c7 |
line wrap: on
line diff
--- a/plugins/mod_bosh.lua Sun Oct 24 15:11:01 2021 +0200 +++ b/plugins/mod_bosh.lua Sun Oct 24 15:17:01 2021 +0200 @@ -236,6 +236,8 @@ if type(reason) == "string" then -- assume stream error close_reply:tag("stream:error") :tag(reason, {xmlns = xmlns_xmpp_streams}); + elseif st.is_stanza(reason) then + close_reply = reason; elseif type(reason) == "table" then if reason.condition then close_reply:tag("stream:error") @@ -246,8 +248,6 @@ if reason.extra then close_reply:add_child(reason.extra); end - elseif reason.name then -- a stanza - close_reply = reason; end end log("info", "Disconnecting client, <stream:error> is: %s", close_reply);