Comparison

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
parent 1326:4f1994f7bd54
parent 1321:0698d0d39b35
child 1330:baad431dabc5
comparison
equal deleted inserted replaced
1327:20285e9d71ee 1328:0709c9564b1c
371 function api:hook(event, handler, priority) 371 function api:hook(event, handler, priority)
372 hooks:set(self.host, self.name, event, handler, true); 372 hooks:set(self.host, self.name, event, handler, true);
373 (hosts[self.host] or prosody).events.add_handler(event, handler, priority); 373 (hosts[self.host] or prosody).events.add_handler(event, handler, priority);
374 end 374 end
375 375
376 function api:hook_stanza(xmlns, name, handler, priority)
377 if not handler and type(name) == "function" then
378 -- If only 2 options then they specified no xmlns
379 xmlns, name, handler, priority = nil, xmlns, name, handler;
380 elseif not (handler and name) then
381 self:log("warn", "Error: Insufficient parameters to module:hook_stanza()");
382 return;
383 end
384 return api.hook(self, "stanza/"..(xmlns and (xmlns..":") or "")..name, function (data) return handler(data.origin, data.stanza, data); end, priority);
385 end
386
376 -------------------------------------------------------------------- 387 --------------------------------------------------------------------
377 388
378 local actions = {}; 389 local actions = {};
379 390
380 function actions.load(params) 391 function actions.load(params)