comparison mod_sasl2_bind2/mod_sasl2_bind2.lua @ 5043:17b87fffdb91

mod_sasl2_bind2: Move <inline> into <bind> feature element This mirrors the equivalent change in SASL2.
author Matthew Wild <mwild1@gmail.com>
date Wed, 21 Sep 2022 10:31:50 +0100
parents c0d243b27e64
children f64d834ba744
comparison
equal deleted inserted replaced
5042:166fd192f39c 5043:17b87fffdb91
7 local xmlns_bind2 = "urn:xmpp:bind2:1"; 7 local xmlns_bind2 = "urn:xmpp:bind2:1";
8 local xmlns_sasl2 = "urn:xmpp:sasl:2"; 8 local xmlns_sasl2 = "urn:xmpp:sasl:2";
9 9
10 -- Advertise what we can do 10 -- Advertise what we can do
11 11
12 module:hook("stream-features", function(event) 12 module:hook("advertise-sasl-features", function(event)
13 local origin, features = event.origin, event.features; 13 local bind = st.stanza("bind", { xmlns = xmlns_bind2 });
14 local inline = st.stanza("inline");
15 module:fire_event("advertise-bind-features", { origin = event.session, features = inline });
16 bind:add_direct_child(inline);
14 17
15 if origin.type ~= "c2s_unauthed" then 18 event.features:add_direct_child(bind);
16 return;
17 end
18
19 local inline = st.stanza("inline", { xmlns = xmlns_bind2 });
20 module:fire_event("advertise-bind-features", { origin = origin, features = inline });
21 features:add_direct_child(inline);
22 end, 1);
23
24 module:hook("advertise-sasl-features", function(event)
25 event.features:tag("bind", { xmlns = xmlns_bind2 }):up();
26 end, 1); 19 end, 1);
27 20
28 -- Helper to actually bind a resource to a session 21 -- Helper to actually bind a resource to a session
29 22
30 local function do_bind(session, bind_request) 23 local function do_bind(session, bind_request)