aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-06-06 17:08:47 +0100
committerMatthew Wild <mwild1@gmail.com>2009-06-06 17:08:47 +0100
commitca4e395f0cb12ca39f9220feb2f984ad0be9d274 (patch)
treee446963d420365bdffbd204136d9f9795587510a /core
parent114a89b6646b5cfe88cebe83422e84ef9e3d94b7 (diff)
downloadprosody-ca4e395f0cb12ca39f9220feb2f984ad0be9d274.tar.gz
prosody-ca4e395f0cb12ca39f9220feb2f984ad0be9d274.zip
modulemanager: Allow setting priority of stanza handlers
Diffstat (limited to 'core')
-rw-r--r--core/modulemanager.lua10
1 files changed, 5 insertions, 5 deletions
diff --git a/core/modulemanager.lua b/core/modulemanager.lua
index 92a50abb..6d857d59 100644
--- a/core/modulemanager.lua
+++ b/core/modulemanager.lua
@@ -368,20 +368,20 @@ function api:fire_event(...)
return (hosts[self.host] or prosody).events.fire_event(...);
end
-function api:hook(event, handler)
+function api:hook(event, handler, priority)
hooks:set(self.host, self.name, event, handler, true);
- (hosts[self.host] or prosody).events.add_handler(event, handler);
+ (hosts[self.host] or prosody).events.add_handler(event, handler, priority);
end
-function api:hook_stanza(xmlns, name, handler)
+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 = nil, xmlns, name;
+ xmlns, name, handler, priority = nil, xmlns, name, handler;
elseif not (handler and name and xmlns) then
module: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);
+ return api.hook(self, "stanza/"..(xmlns and (xmlns..":") or "")..name, function (data) return handler(data.origin, data.stanza, data); end, priority);
end
--------------------------------------------------------------------