From 777a395b47795ba460f31bca1f6ab786f49d56d0 Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Sat, 30 May 2009 17:35:32 +0500 Subject: modulemanager: Added hook(event, handler) to the plugin API --- core/modulemanager.lua | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'core/modulemanager.lua') 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 = {}; -- cgit v1.2.3