comparison mod_client_management/mod_client_management.lua @ 5756:e199f33f7a2e

mod_client_management: Include session in the other new-client event too
author Kim Alvefur <zash@zash.se>
date Sat, 02 Dec 2023 11:18:57 +0100
parents 3730992d0c7c
children 13094c707414
comparison
equal deleted inserted replaced
5755:4a353ccce220 5756:e199f33f7a2e
131 131
132 -- Store updated state 132 -- Store updated state
133 client_store:set_key(session.username, client_state.id, client_state); 133 client_store:set_key(session.username, client_state.id, client_state);
134 134
135 if is_new_client then 135 if is_new_client then
136 module:fire_event("client_management/new-client", { client = client_state }); 136 module:fire_event("client_management/new-client", { client = client_state; session = session });
137 end 137 end
138 end); 138 end);
139 139
140 if strict then 140 if strict then
141 module:hook_tag(xmlns_sasl2, "authenticate", function (session, auth) 141 module:hook_tag(xmlns_sasl2, "authenticate", function (session, auth)
423 end); 423 end);
424 424
425 425
426 -- Command 426 -- Command
427 427
428 module:once(function () 428 module:on_ready(function ()
429 local console_env = module:shared("/*/admin_shell/env"); 429 local console_env = module:shared("/*/admin_shell/env");
430 if not console_env.user then return; end -- admin_shell probably not loaded 430 if not console_env.user then return; end -- admin_shell probably not loaded
431 431
432 function console_env.user:clients(user_jid) 432 function console_env.user:clients(user_jid)
433 local username, host = jid.split(user_jid); 433 local username, host = jid.split(user_jid);