Software /
code /
prosody
Comparison
plugins/mod_smacks.lua @ 11979:705c4c07a860
mod_smacks: Use stanza type checking function for correctness
Non-stanza tables with an 'attr' field might be rare in Prosody, but
better to be Correct
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 01 Dec 2021 21:04:32 +0100 |
parent | 11978:628374809421 |
child | 11980:a91494a4c3d0 |
comparison
equal
deleted
inserted
replaced
11978:628374809421 | 11979:705c4c07a860 |
---|---|
194 local function outgoing_stanza_filter(stanza, session) | 194 local function outgoing_stanza_filter(stanza, session) |
195 -- XXX: Normally you wouldn't have to check the xmlns for a stanza as it's | 195 -- XXX: Normally you wouldn't have to check the xmlns for a stanza as it's |
196 -- supposed to be nil. | 196 -- supposed to be nil. |
197 -- However, when using mod_smacks with mod_websocket, then mod_websocket's | 197 -- However, when using mod_smacks with mod_websocket, then mod_websocket's |
198 -- stanzas/out filter can get called before this one and adds the xmlns. | 198 -- stanzas/out filter can get called before this one and adds the xmlns. |
199 local is_stanza = stanza.attr and | 199 local is_stanza = st.is_stanza(stanza) and |
200 (not stanza.attr.xmlns or stanza.attr.xmlns == 'jabber:client') | 200 (not stanza.attr.xmlns or stanza.attr.xmlns == 'jabber:client') |
201 and not stanza.name:find":"; | 201 and not stanza.name:find":"; |
202 | 202 |
203 if is_stanza and not stanza._cached then | 203 if is_stanza and not stanza._cached then |
204 local queue = session.outgoing_stanza_queue; | 204 local queue = session.outgoing_stanza_queue; |