Software /
code /
prosody
Comparison
core/modulemanager.lua @ 1321:0698d0d39b35
modulemanager: Don't require xmlns to be non-nil
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 06 Jun 2009 17:17:16 +0100 |
parent | 1320:9c736b993e07 |
child | 1328:0709c9564b1c |
comparison
equal
deleted
inserted
replaced
1320:9c736b993e07 | 1321:0698d0d39b35 |
---|---|
375 | 375 |
376 function api:hook_stanza(xmlns, name, handler, priority) | 376 function api:hook_stanza(xmlns, name, handler, priority) |
377 if not handler and type(name) == "function" then | 377 if not handler and type(name) == "function" then |
378 -- If only 2 options then they specified no xmlns | 378 -- If only 2 options then they specified no xmlns |
379 xmlns, name, handler, priority = nil, xmlns, name, handler; | 379 xmlns, name, handler, priority = nil, xmlns, name, handler; |
380 elseif not (handler and name and xmlns) then | 380 elseif not (handler and name) then |
381 self:log("warn", "Error: Insufficient parameters to module:hook_stanza()"); | 381 self:log("warn", "Error: Insufficient parameters to module:hook_stanza()"); |
382 return; | 382 return; |
383 end | 383 end |
384 return api.hook(self, "stanza/"..(xmlns and (xmlns..":") or "")..name, function (data) return handler(data.origin, data.stanza, data); end, priority); | 384 return api.hook(self, "stanza/"..(xmlns and (xmlns..":") or "")..name, function (data) return handler(data.origin, data.stanza, data); end, priority); |
385 end | 385 end |