/usr/lib/prosody/util/adhoc.lua is in prosody 0.9.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | local function new_simple_form(form, result_handler)
return function(self, data, state)
if state then
if data.action == "cancel" then
return { status = "canceled" };
end
local fields, err = form:data(data.form);
return result_handler(fields, err, data);
else
return { status = "executing", actions = {"next", "complete", default = "complete"}, form = form }, "executing";
end
end
end
local function new_initial_data_form(form, initial_data, result_handler)
return function(self, data, state)
if state then
if data.action == "cancel" then
return { status = "canceled" };
end
local fields, err = form:data(data.form);
return result_handler(fields, err, data);
else
return { status = "executing", actions = {"next", "complete", default = "complete"},
form = { layout = form, values = initial_data() } }, "executing";
end
end
end
return { new_simple_form = new_simple_form,
new_initial_data_form = new_initial_data_form };
|