aboutsummaryrefslogtreecommitdiffstats
path: root/core/modulemanager.lua
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2009-05-30 17:35:32 +0500
committerWaqas Hussain <waqas20@gmail.com>2009-05-30 17:35:32 +0500
commit777a395b47795ba460f31bca1f6ab786f49d56d0 (patch)
tree9986cbc0937168fdd913a1f3045f5c17a4dfada7 /core/modulemanager.lua
parent66e22f3c576fcb4666a0eb8156015cdd2bb79e2c (diff)
downloadprosody-777a395b47795ba460f31bca1f6ab786f49d56d0.tar.gz
prosody-777a395b47795ba460f31bca1f6ab786f49d56d0.zip
modulemanager: Added hook(event, handler) to the plugin API
Diffstat (limited to 'core/modulemanager.lua')
-rw-r--r--core/modulemanager.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/modulemanager.lua b/core/modulemanager.lua
index 57a44c29..901659f7 100644
--- a/core/modulemanager.lua
+++ b/core/modulemanager.lua
@@ -354,6 +354,14 @@ function api:fire_event(...)
return eventmanager.fire_event(...);
end
+function api:hook(event, handler)
+ if self.host ~= '*' then
+ hosts[self.host].events.add_handler(event, handler);
+ else
+ self:log("error", "Global module attempting to hook a host-specific event: %s", event);
+ end
+end
+
--------------------------------------------------------------------
local actions = {};