aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2022-04-27 17:18:46 +0200
committerKim Alvefur <zash@zash.se>2022-04-27 17:18:46 +0200
commit9e5bf4fc486527b33244ff2f929d8bfb7472d323 (patch)
treed0ddedd90661a60714f92578893cb47dc71d776b
parent93347db1241f8c803c24c6cf615389cb237f0031 (diff)
downloadprosody-9e5bf4fc486527b33244ff2f929d8bfb7472d323.tar.gz
prosody-9e5bf4fc486527b33244ff2f929d8bfb7472d323.zip
core.moduleapi: Fix 'global' property via :context() - #1748
The 'global' property should reflect whether the module API instance represents the global context or a VirtualHost or Component context. However the module:context() method did not override this, leading the property of the previous module shining trough, leading to bugs in code relying on the 'global' property. See also #1736
-rw-r--r--core/moduleapi.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/moduleapi.lua b/core/moduleapi.lua
index 071dabc2..870a6a50 100644
--- a/core/moduleapi.lua
+++ b/core/moduleapi.lua
@@ -307,7 +307,7 @@ end
function api:context(host)
- return setmetatable({host=host or "*"}, {__index=self,__newindex=self});
+ return setmetatable({ host = host or "*", global = "*" == host }, { __index = self, __newindex = self });
end
function api:add_item(key, value)