# HG changeset patch # User Matthew Wild # Date 1663752710 -3600 # Node ID 17b87fffdb917a8bc9d9254576c49452d3b2fa39 # Parent 166fd192f39c7059fda5be5bf117ed99edde866d mod_sasl2_bind2: Move into feature element This mirrors the equivalent change in SASL2. diff -r 166fd192f39c -r 17b87fffdb91 mod_sasl2_bind2/mod_sasl2_bind2.lua --- a/mod_sasl2_bind2/mod_sasl2_bind2.lua Wed Sep 21 10:25:34 2022 +0100 +++ b/mod_sasl2_bind2/mod_sasl2_bind2.lua Wed Sep 21 10:31:50 2022 +0100 @@ -9,20 +9,13 @@ -- Advertise what we can do -module:hook("stream-features", function(event) - local origin, features = event.origin, event.features; - - if origin.type ~= "c2s_unauthed" then - return; - end +module:hook("advertise-sasl-features", function(event) + local bind = st.stanza("bind", { xmlns = xmlns_bind2 }); + local inline = st.stanza("inline"); + module:fire_event("advertise-bind-features", { origin = event.session, features = inline }); + bind:add_direct_child(inline); - local inline = st.stanza("inline", { xmlns = xmlns_bind2 }); - module:fire_event("advertise-bind-features", { origin = origin, features = inline }); - features:add_direct_child(inline); -end, 1); - -module:hook("advertise-sasl-features", function(event) - event.features:tag("bind", { xmlns = xmlns_bind2 }):up(); + event.features:add_direct_child(bind); end, 1); -- Helper to actually bind a resource to a session