diff options
author | Waqas Hussain <waqas20@gmail.com> | 2009-06-12 13:46:31 +0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2009-06-12 13:46:31 +0500 |
commit | 579f4853288925d6312af5677e3d7f072b81f1b2 (patch) | |
tree | de8f3faa8b1483c5a800f2d6abfa31376ad938d8 /core/modulemanager.lua | |
parent | 5e62fe6fdbf2dfd0fad41b1ee027cc14114dd84e (diff) | |
parent | aa79672dbdd1bef94119e520daacb47ac06d3935 (diff) | |
download | prosody-579f4853288925d6312af5677e3d7f072b81f1b2.tar.gz prosody-579f4853288925d6312af5677e3d7f072b81f1b2.zip |
Merge
Diffstat (limited to 'core/modulemanager.lua')
-rw-r--r-- | core/modulemanager.lua | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/core/modulemanager.lua b/core/modulemanager.lua index 748c7dce..004b7dfb 100644 --- a/core/modulemanager.lua +++ b/core/modulemanager.lua @@ -128,7 +128,7 @@ function load(host, module_name, config) local success, ret = pcall(mod); if not success then - log("error", "Error initialising module '%s': %s", name or "nil", ret or "nil"); + log("error", "Error initialising module '%s': %s", module_name or "nil", ret or "nil"); return nil, ret; end @@ -373,6 +373,17 @@ function api:hook(event, handler, priority) (hosts[self.host] or prosody).events.add_handler(event, handler, priority); end +function api:hook_stanza(xmlns, name, handler, priority) + if not handler and type(name) == "function" then + -- If only 2 options then they specified no xmlns + xmlns, name, handler, priority = nil, xmlns, name, handler; + elseif not (handler and name) then + self:log("warn", "Error: Insufficient parameters to module:hook_stanza()"); + return; + end + return api.hook(self, "stanza/"..(xmlns and (xmlns..":") or "")..name, function (data) return handler(data.origin, data.stanza, data); end, priority); +end + -------------------------------------------------------------------- local actions = {}; |