end
local data_path = "data";
+local callback;
------- API -------------
log("info", "Setting data path to: %s", path);
data_path = path;
end
+function set_callback(func)
+ callback = func;
+end
function getpath(username, host, datastore, ext, create)
ext = ext or "dat";
if not data then
data = {};
end
+ if callback and callback(username, host, datastore) then return true; end
-- save the datastore
local f, msg = io_open(getpath(username, host, datastore, nil, true), "w+");
if not f then
function list_append(username, host, datastore, data)
if not data then return; end
+ if callback and callback(username, host, datastore) then return true; end
-- save the datastore
local f, msg = io_open(getpath(username, host, datastore, "list", true), "a+");
if not f then
if not data then
data = {};
end
+ if callback and callback(username, host, datastore) then return true; end
-- save the datastore
local f, msg = io_open(getpath(username, host, datastore, "list", true), "w+");
if not f then