Comparison

mod_sasl2_bind2/mod_sasl2_bind2.lua @ 5060:bc491065c221

mod_sasl2_bind2, mod_sasl2_sm: Remove bind2 <features/> wrapper element This was dropped from the spec. It's more consistent with SASL2.
author Matthew Wild <mwild1@gmail.com>
date Tue, 27 Sep 2022 18:23:42 +0100
parent 5047:023f21bfcc08
child 5093:f2dfbcc676a6
comparison
equal deleted inserted replaced
5059:5f1120c284c5 5060:bc491065c221
42 end 42 end
43 43
44 -- Enable inline features requested by the client 44 -- Enable inline features requested by the client
45 45
46 local function enable_features(session, bind_request, bind_result) 46 local function enable_features(session, bind_request, bind_result)
47 local features = bind_request:get_child("features");
48 if not features then return; end
49 module:fire_event("enable-bind-features", { 47 module:fire_event("enable-bind-features", {
50 session = session; 48 session = session;
51 features = features; 49 request = bind_request;
52 result = bind_result; 50 result = bind_result;
53 }); 51 });
54 end 52 end
55 53
56 -- SASL 2 integration 54 -- SASL 2 integration
90 features:tag("feature", { var = "urn:xmpp:carbons:2" }):up(); 88 features:tag("feature", { var = "urn:xmpp:carbons:2" }):up();
91 features:tag("feature", { var = "urn:xmpp:csi:0" }):up(); 89 features:tag("feature", { var = "urn:xmpp:csi:0" }):up();
92 end); 90 end);
93 91
94 module:hook("enable-bind-features", function (event) 92 module:hook("enable-bind-features", function (event)
95 local session, features = event.session, event.features; 93 local session, request = event.session, event.request;
96 94
97 -- Carbons 95 -- Carbons
98 if features:get_child("enable", "urn:xmpp:carbons:2") then 96 if request:get_child("enable", "urn:xmpp:carbons:2") then
99 session.want_carbons = true; 97 session.want_carbons = true;
100 event.result:tag("enabled", { xmlns = "urn:xmpp:carbons:2" }):up(); 98 event.result:tag("enabled", { xmlns = "urn:xmpp:carbons:2" }):up();
101 end 99 end
102 100
103 -- CSI 101 -- CSI
104 local csi_state_tag = features:child_with_ns("urn:xmpp:csi:0"); 102 local csi_state_tag = request:child_with_ns("urn:xmpp:csi:0");
105 if csi_state_tag then 103 if csi_state_tag then
106 session.state = csi_state_tag.name; 104 session.state = csi_state_tag.name;
107 end 105 end
108 end, 10); 106 end, 10);