mod_sasl2/mod_sasl2.lua
changeset 5025 f62b091b1c81
parent 5024 6a36dae4a88d
child 5027 90772a9c92a0
equal deleted inserted replaced
5024:6a36dae4a88d 5025: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");