datamanager: Fixed incorrect callback result checking
authorWaqas Hussain <waqas20@gmail.com>
Thu, 02 Jul 2009 21:34:45 +0500
changeset 1462 44780b856ce7
parent 1461 51f0202b0868
child 1463 4ad920999cfa
child 1464 047ed6e52a41
datamanager: Fixed incorrect callback result checking
util/datamanager.lua
--- a/util/datamanager.lua	Thu Jul 02 15:43:27 2009 +0100
+++ b/util/datamanager.lua	Thu Jul 02 21:34:45 2009 +0500
@@ -62,7 +62,7 @@
 local function callback(username, host, datastore, data)
 	for _, f in ipairs(callbacks) do
 		username, host, datastore, data = f(username, host, datastore, data);
-		if not username then break; end
+		if username == false then break; end
 	end
 	
 	return username, host, datastore, data;
@@ -123,7 +123,7 @@
 	end
 
 	username, host, datastore, data = callback(username, host, datastore, data);
-	if not username then
+	if username == false then
 		return true; -- Don't save this data at all
 	end
 
@@ -147,7 +147,7 @@
 
 function list_append(username, host, datastore, data)
 	if not data then return; end
-	if callback and callback(username, host, datastore) then return true; end
+	if callback(username, host, datastore) == false then return true; end
 	-- save the datastore
 	local f, msg = io_open(getpath(username, host, datastore, "list", true), "a+");
 	if not f then
@@ -165,7 +165,7 @@
 	if not data then
 		data = {};
 	end
-	if callback and callback(username, host, datastore) then return true; end
+	if callback(username, host, datastore) == false then return true; end
 	-- save the datastore
 	local f, msg = io_open(getpath(username, host, datastore, "list", true), "w+");
 	if not f then