# HG changeset patch # User Waqas Hussain # Date 1243686932 -18000 # Node ID 6f251813f1e53a8a270aef05ebb86bc7b635ddc6 # Parent 853d3d76ba94760dba5be80172a0f826dc0691c4 modulemanager: Added hook(event, handler) to the plugin API diff -r 853d3d76ba94 -r 6f251813f1e5 core/modulemanager.lua --- a/core/modulemanager.lua Sat May 30 02:06:04 2009 +0500 +++ b/core/modulemanager.lua Sat May 30 17:35:32 2009 +0500 @@ -354,6 +354,14 @@ 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 = {};