aboutsummaryrefslogtreecommitdiffstats
path: root/core/actions.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-01-12 04:05:10 +0000
committerMatthew Wild <mwild1@gmail.com>2009-01-12 04:05:10 +0000
commit9ffcaaa1f99a185bec4160399d0b8f52a70a7527 (patch)
tree93939e713530247bb8506050d99b855da837680d /core/actions.lua
parente50d22fcc44c67d513e6b527305134831bdd327b (diff)
downloadprosody-9ffcaaa1f99a185bec4160399d0b8f52a70a7527.tar.gz
prosody-9ffcaaa1f99a185bec4160399d0b8f52a70a7527.zip
Add core.actions for managing server 'actions'; and make modulemanager register actions 'load' and 'unload'
Diffstat (limited to 'core/actions.lua')
-rw-r--r--core/actions.lua19
1 files changed, 19 insertions, 0 deletions
diff --git a/core/actions.lua b/core/actions.lua
new file mode 100644
index 00000000..d0be5aeb
--- /dev/null
+++ b/core/actions.lua
@@ -0,0 +1,19 @@
+
+local actions = {};
+
+function register(path, t)
+ local curr = actions;
+ for comp in path:gmatch("([^/]+)/") do
+ if curr[comp] == nil then
+ curr[comp] = {};
+ end
+ curr = curr[comp];
+ if type(curr) ~= "table" then
+ return nil, "path-taken";
+ end
+ end
+ curr[path:match("/([^/]+)$")] = t;
+ return true;
+end
+
+return { actions = actions, register= register }; \ No newline at end of file