aboutsummaryrefslogtreecommitdiffstats
path: root/core/modulemanager.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-06-07 14:19:36 +0100
committerMatthew Wild <mwild1@gmail.com>2009-06-07 14:19:36 +0100
commite9c388582baab737b5aa092674bf8fb43a5a9e60 (patch)
tree5363ab1ef0780bc4038665de1b4b9149ae8fe4f4 /core/modulemanager.lua
parent2ef63904d65d0883e2687aa3d23bcbecf80f920e (diff)
parent2c8f13edc6e93b58c6e21fe8cb46bd3a84221a8b (diff)
downloadprosody-e9c388582baab737b5aa092674bf8fb43a5a9e60.tar.gz
prosody-e9c388582baab737b5aa092674bf8fb43a5a9e60.zip
Automated merge with http://waqas.ath.cx:8000/
Diffstat (limited to 'core/modulemanager.lua')
-rw-r--r--core/modulemanager.lua11
1 files changed, 11 insertions, 0 deletions
diff --git a/core/modulemanager.lua b/core/modulemanager.lua
index 748c7dce..187e4d6e 100644
--- a/core/modulemanager.lua
+++ b/core/modulemanager.lua
@@ -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 = {};