Changeset

1247:4721e4124692

modulemanager: module:hook now allows global modules to hook events on the prosody.events object
author Waqas Hussain <waqas20@gmail.com>
date Sun, 31 May 2009 00:51:13 +0500
parents 1246:3622ed42b92c
children 1248:9a482f76a20a
files core/modulemanager.lua
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/core/modulemanager.lua	Sun May 31 00:46:41 2009 +0500
+++ b/core/modulemanager.lua	Sun May 31 00:51:13 2009 +0500
@@ -20,6 +20,7 @@
 local st = require "util.stanza";
 
 local hosts = hosts;
+local prosody = prosody;
 
 local loadfile, pcall = loadfile, pcall;
 local setmetatable, setfenv, getfenv = setmetatable, setfenv, getfenv;
@@ -358,7 +359,7 @@
 	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);
+		prosody.events.add_handler(event, handler);
 	end
 end