mod_component: Set module status to indicate whether component is connected

This commit is contained in:
Matthew Wild 2019-03-19 09:08:06 +00:00
parent d89b760be1
commit c6efcf09be

View file

@ -49,6 +49,7 @@ function module.add_host(module)
local send; local send;
local function on_destroy(session, err) --luacheck: ignore 212/err local function on_destroy(session, err) --luacheck: ignore 212/err
module:set_status("warn", err and ("Disconnected: "..err) or "Disconnected");
env.connected = false; env.connected = false;
env.session = false; env.session = false;
send = nil; send = nil;
@ -102,6 +103,7 @@ function module.add_host(module)
module:log("info", "External component successfully authenticated"); module:log("info", "External component successfully authenticated");
session.send(st.stanza("handshake")); session.send(st.stanza("handshake"));
module:fire_event("component-authenticated", { session = session }); module:fire_event("component-authenticated", { session = session });
module:set_status("info", "Connected");
return true; return true;
end end