Changeset

9870:8f4880576835

mod_component: Set module status to indicate whether component is connected
author Matthew Wild <mwild1@gmail.com>
date Tue, 19 Mar 2019 09:08:06 +0000
parents 9869:7be5477c399e
children 9871:744e08ac5596
files plugins/mod_component.lua
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_component.lua	Tue Mar 19 09:07:36 2019 +0000
+++ b/plugins/mod_component.lua	Tue Mar 19 09:08:06 2019 +0000
@@ -49,6 +49,7 @@
 	local send;
 
 	local function on_destroy(session, err) --luacheck: ignore 212/err
+		module:set_status("warn", err and ("Disconnected: "..err) or "Disconnected");
 		env.connected = false;
 		env.session = false;
 		send = nil;
@@ -102,6 +103,7 @@
 		module:log("info", "External component successfully authenticated");
 		session.send(st.stanza("handshake"));
 		module:fire_event("component-authenticated", { session = session });
+		module:set_status("info", "Connected");
 
 		return true;
 	end