comparison mod_sasl2/mod_sasl2.lua @ 5021:f62b091b1c81

mod_sasl2: Eventually return true from success handler ...while allowing other handlers to run in the priority range -1000 to -2000.
author Matthew Wild <mwild1@gmail.com>
date Sun, 28 Aug 2022 11:25:21 +0100
parents 6a36dae4a88d
children 90772a9c92a0
comparison
equal deleted inserted replaced
5020:6a36dae4a88d 5021:f62b091b1c81
103 local features = st.stanza("stream:features"); 103 local features = st.stanza("stream:features");
104 module:fire_event("stream-features", { origin = session, features = features }); 104 module:fire_event("stream-features", { origin = session, features = features });
105 session.send(features); 105 session.send(features);
106 end, -1000); 106 end, -1000);
107 107
108 -- The gap here is to allow modules to do stuff to the stream after the stanza
109 -- is sent, but before we proceed with anything else. This is expected to be
110 -- a common pattern with SASL2, which allows atomic negotiation of a bunch of
111 -- stream features.
112 module:hook("sasl2/c2s/success", function (event) --luacheck: ignore 212/event
113 return true;
114 end, -2000);
115
108 local function process_cdata(session, cdata) 116 local function process_cdata(session, cdata)
109 if cdata then 117 if cdata then
110 cdata = base64.decode(cdata); 118 cdata = base64.decode(cdata);
111 if not cdata then 119 if not cdata then
112 return handle_status(session, "failure"); 120 return handle_status(session, "failure");