Software /
code /
prosody
File
util/adhoc.lua @ 8212:66173e4b355a
util.pubsub: Add the publisher as an attribute in the item element.
This makes the backend able to obtain the publisher without changing
the API.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Sun, 02 Apr 2017 19:08:54 +0100 |
parent | 7912:2c204ba8e52e |
child | 8382:e5d00bf4a4d5 |
line wrap: on
line source
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(data) } }, "executing"; end end end return { new_simple_form = new_simple_form, new_initial_data_form = new_initial_data_form };