# HG changeset patch # User Matthew Wild # Date 1663867544 -3600 # Node ID e89aad13a52a3deb4332aeca908a07393fad960e # Parent 3697d19d5fd92a1a263c4f7ca1543bae4d438ac3 mod_sasl2: Further break up success handling, into pre/post stream:features This allows us to enable mod_smacks after sending success, but before sending stream:features. Previously, the features were being calculated before SM was finalized on the session. We can't finalize SM before sending because it may generate stanzas. diff -r 3697d19d5fd9 -r e89aad13a52a mod_sasl2/mod_sasl2.lua --- a/mod_sasl2/mod_sasl2.lua Thu Sep 22 16:48:05 2022 +0100 +++ b/mod_sasl2/mod_sasl2.lua Thu Sep 22 18:25:44 2022 +0100 @@ -158,10 +158,14 @@ local session = event.session event.success:text_tag("authorization-identifier", jid_join(session.username, session.host, session.resource)); session.send(event.success); +end, -1000); + +module:hook("sasl2/c2s/success", function (event) + local session = event.session; local features = st.stanza("stream:features"); module:fire_event("stream-features", { origin = session, features = features }); session.send(features); -end, -1000); +end, -1500); -- The gap here is to allow modules to do stuff to the stream after the stanza -- is sent, but before we proceed with anything else. This is expected to be