aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2021-12-22 14:40:42 +0000
committerMatthew Wild <mwild1@gmail.com>2021-12-22 14:40:42 +0000
commitbd455426f6ade80b80ab44f3ae3e946e44303120 (patch)
treed15f657b66f026c837d46c0d0175a41b02e3febe /core
parent6671cc037e8afc4c416556af6e35a26e48fc75e5 (diff)
downloadprosody-bd455426f6ade80b80ab44f3ae3e946e44303120.tar.gz
prosody-bd455426f6ade80b80ab44f3ae3e946e44303120.zip
moduleapi: Support stripping of multi-word from module names
The goal is to allow module:provides("foo-bar") with a mod_foo_bar_ prefix being stripped. It will break any existing modules that use a prefix and have hyphens instead of underscores. No such modules are known.
Diffstat (limited to 'core')
-rw-r--r--core/moduleapi.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/moduleapi.lua b/core/moduleapi.lua
index 6a91a045..24d99c69 100644
--- a/core/moduleapi.lua
+++ b/core/moduleapi.lua
@@ -355,7 +355,7 @@ function api:provides(name, item)
local item_name = self.name;
-- Strip a provider prefix to find the item name
-- (e.g. "auth_foo" -> "foo" for an auth provider)
- if item_name:find(name.."_", 1, true) == 1 then
+ if item_name:find((name:gsub("%-", "_")).."_", 1, true) == 1 then
item_name = item_name:sub(#name+2);
end
item.name = item_name;