Diff

core/modulemanager.lua @ 42:2e3715e30912

Small fixes
author Matthew Wild <mwild1@gmail.com>
date Sat, 04 Oct 2008 02:09:46 +0100
parent 39:89877d61ac51
child 47:33ed4c6ac249
line wrap: on
line diff
--- a/core/modulemanager.lua	Fri Oct 03 22:21:01 2008 +0100
+++ b/core/modulemanager.lua	Sat Oct 04 02:09:46 2008 +0100
@@ -19,6 +19,7 @@
 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 @@
 	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 @@
 			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