aboutsummaryrefslogtreecommitdiffstats
path: root/core/modulemanager.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2013-04-03 13:53:21 +0100
committerMatthew Wild <mwild1@gmail.com>2013-04-03 13:53:21 +0100
commit1213909d149d2ae2d697d6694ee1a30ef41c47f4 (patch)
treebf22e9f39d9ccaa98ba9f214cfa01d7c3408d46a /core/modulemanager.lua
parentc8e37d89fdf5c9b5990cd309d53707f990986559 (diff)
parent64579702abbbb36676a94a86d88cc54c119f4433 (diff)
downloadprosody-1213909d149d2ae2d697d6694ee1a30ef41c47f4.tar.gz
prosody-1213909d149d2ae2d697d6694ee1a30ef41c47f4.zip
Merge 0.9->trunk
Diffstat (limited to 'core/modulemanager.lua')
-rw-r--r--core/modulemanager.lua19
1 files changed, 18 insertions, 1 deletions
diff --git a/core/modulemanager.lua b/core/modulemanager.lua
index 35b9d0e5..535c227b 100644
--- a/core/modulemanager.lua
+++ b/core/modulemanager.lua
@@ -19,7 +19,7 @@ local prosody = prosody;
local pcall, xpcall = pcall, xpcall;
local setmetatable, rawget = setmetatable, rawget;
-local pairs, type, tostring = pairs, type, tostring;
+local ipairs, pairs, type, tostring, t_insert = ipairs, pairs, type, tostring, table.insert;
local debug_traceback = debug.traceback;
local unpack, select = unpack, select;
@@ -278,6 +278,23 @@ function get_module(host, name)
return modulemap[host] and modulemap[host][name];
end
+function get_items(key, host)
+ local result = {};
+ local modules = modulemap[host];
+ if not key or not host or not modules then return nil; end
+
+ for _, module in pairs(modules) do
+ local mod = module.module;
+ if mod.items and mod.items[key] then
+ for _, value in ipairs(mod.items[key]) do
+ t_insert(result, value);
+ end
+ end
+ end
+
+ return result;
+end
+
function get_modules(host)
return modulemap[host];
end