Mercurial > prosody-hg
diff core/modulemanager.lua @ 1328:0709c9564b1c
Automated merge with http://waqas.ath.cx:8000/
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Sun, 07 Jun 2009 14:19:36 +0100 |
| parents | 4f1994f7bd54 0698d0d39b35 |
| children | baad431dabc5 |
line wrap: on
line diff
--- a/core/modulemanager.lua Sun Jun 07 18:06:01 2009 +0500 +++ b/core/modulemanager.lua Sun Jun 07 14:19:36 2009 +0100 @@ -373,6 +373,17 @@ (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 = {};
