diff options
author | Waqas Hussain <waqas20@gmail.com> | 2009-05-30 17:35:32 +0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2009-05-30 17:35:32 +0500 |
commit | 777a395b47795ba460f31bca1f6ab786f49d56d0 (patch) | |
tree | 9986cbc0937168fdd913a1f3045f5c17a4dfada7 /core/modulemanager.lua | |
parent | 66e22f3c576fcb4666a0eb8156015cdd2bb79e2c (diff) | |
download | prosody-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.lua | 8 |
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 = {}; |