From 9d19964c829659b3b25ef472f899d9702b2add2f Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Sat, 4 Oct 2008 02:09:46 +0100 Subject: Small fixes --- core/modulemanager.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'core/modulemanager.lua') diff --git a/core/modulemanager.lua b/core/modulemanager.lua index 2779746e..78faad92 100644 --- a/core/modulemanager.lua +++ b/core/modulemanager.lua @@ -19,6 +19,7 @@ local handlers = {}; local modulehelpers = setmetatable({}, { __index = _G }); function modulehelpers.add_iq_handler(origin_type, xmlns, handler) + if not (origin_type and handler and xmlns) then return false; end handlers[origin_type] = handlers[origin_type] or {}; handlers[origin_type].iq = handlers[origin_type].iq or {}; if not handlers[origin_type].iq[xmlns] then @@ -30,7 +31,8 @@ function modulehelpers.add_iq_handler(origin_type, xmlns, handler) end end -function modulehelpers.add_handler(origin_type, tag, handler) +function modulehelpers.add_handler(origin_type, tag, xmlns, handler) + if not (origin_type and tag and xmlns and handler) then return false; end handlers[origin_type] = handlers[origin_type] or {}; if not handlers[origin_type][tag] then handlers[origin_type][tag]= handler; @@ -80,7 +82,6 @@ function handle_stanza(origin, stanza) end end - --FIXME: All iq's must be replied to, here we should return service-unavailable I think elseif handlers[origin_type] then local handler = handlers[origin_type][name]; if handler then -- cgit v1.2.3