Changeset

5130:0772facc786f

mod_ping_muc: Error out if loaded on Components Several users report tracebacks that could only happen when loaded outside of a VirtualHost
author Kim Alvefur <zash@zash.se>
date Sat, 07 Jan 2023 17:36:16 +0100
parents 5129:cde38b7de04a
children 5131:82e7251d4f52
files mod_ping_muc/README.md mod_ping_muc/mod_ping_muc.lua
diffstat 2 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_ping_muc/README.md	Sat Jan 07 17:15:47 2023 +0100
+++ b/mod_ping_muc/README.md	Sat Jan 07 17:36:16 2023 +0100
@@ -23,6 +23,10 @@
 
 # Configuring
 
+No configuration.  Enable as a regular module in
+[`modules_enabled`][doc:modules_enabled] globally or under a
+`VirtualHost`:
+
 ```lua
 modules_enabled = {
 	-- other modules etc
--- a/mod_ping_muc/mod_ping_muc.lua	Sat Jan 07 17:15:47 2023 +0100
+++ b/mod_ping_muc/mod_ping_muc.lua	Sat Jan 07 17:36:16 2023 +0100
@@ -3,6 +3,11 @@
 local set = require "util.set";
 local st = require "util.stanza";
 
+if module:get_host_type() ~= "local" then
+	module:log("error", "mod_%s must be loaded as a regular module, not on Components", module.name);
+	return
+end
+
 module:depends "track_muc_joins";
 module:add_feature("https://modules.prosody.im/mod_" .. module.name);