Changeset

10428:12a10208d86a

mod_csi: Set module status based on whether a CSI handler module appears to be loaded
author Kim Alvefur <zash@zash.se>
date Sat, 23 Nov 2019 17:09:48 +0100 (2019-11-23)
parents 10427:35bc8d495569
children 10429:0b04d25c4ffb
files plugins/mod_csi.lua
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_csi.lua	Sun Nov 17 23:53:51 2019 +0100
+++ b/plugins/mod_csi.lua	Sat Nov 23 17:09:48 2019 +0100
@@ -21,3 +21,12 @@
 module:hook("stanza/"..xmlns_csi..":active", refire_event("csi-client-active"));
 module:hook("stanza/"..xmlns_csi..":inactive", refire_event("csi-client-inactive"));
 
+function module.load()
+	if prosody.hosts[module.host].events._handlers["csi-client-active"] then
+		module:set_status("core", "CSI handler module loaded");
+	else
+		module:set_status("warn", "No CSI handler module loaded");
+	end
+end
+module:hook("module-loaded", module.load);
+module:hook("module-unloaded", module.load);