mod_ping_muc: Error out if loaded on Components
Several users report tracebacks that could only happen when loaded
outside of a VirtualHost
--- 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);