Comparison

mod_sasl2/mod_sasl2.lua @ 6055:23c4c61a1068

mod_muc_gateway_optimize: New module to optimize muc presence to remote gateways Some gateways are happy to receive presence for each participant in MUCs that they are in only once, to any one of their joined JIDs.
author Stephen Paul Weber <singpolyma@singpolyma.net>
date Sun, 17 Nov 2024 22:32:52 -0500
parent 6036:1ef53e0264f4
child 6056:56fa3bad16cc
comparison
equal deleted inserted replaced
6054:d39ddf13ff0a 6055:23c4c61a1068
177 event.success:text_tag("additional-data", base64.encode(event.message)); 177 event.success:text_tag("additional-data", base64.encode(event.message));
178 end 178 end
179 end 179 end
180 end, 1000); 180 end, 1000);
181 181
182 module:hook("sasl2/c2s/tasks", function(event)
183 if event.session.tested then
184 return;
185 end
186
187 return { tasks = { TEST = function(session, el)
188 local data = st.stanza("task-data", { xmlns = xmlns_sasl2 });
189 local count = tonumber(el:get_child_text("test", "test") or "0");
190 if count >= 10000 then
191 session.tested = true
192 module:fire_event("sasl2/"..session.base_type.."/success", {
193 session = session,
194 });
195 else
196 data:text_tag("test", tostring(count + 1), { xmlns = "test" })
197 session.send(data);
198 end
199 end }, text = "Need to test this" };
200 end);
201
182 module:hook("sasl2/c2s/success", function (event) 202 module:hook("sasl2/c2s/success", function (event)
183 local session = event.session 203 local session = event.session
184 event.success:text_tag("authorization-identifier", jid_join(session.username, session.host, session.resource)); 204 event.success:text_tag("authorization-identifier", jid_join(session.username, session.host, session.resource));
185 session.send(event.success); 205 session.send(event.success);
186 end, -1000); 206 end, -1000);