# HG changeset patch # User Florian Zeitz # Date 1255137881 -7200 # Node ID 00d5e133c84daa5da7f3cc3aa8ef9c7b22b7c4eb # Parent fc4806a98fc4d0126387144f631a7a86e497a53d mod_adhoc_cmd_admin: switch to utils.dataforms. Thanks MattJ for making this possible ;) diff -r fc4806a98fc4 -r 00d5e133c84d mod_adhoc_cmd_admin/mod_adhoc_cmd_admin.lua --- a/mod_adhoc_cmd_admin/mod_adhoc_cmd_admin.lua Fri Oct 09 23:23:54 2009 +0200 +++ b/mod_adhoc_cmd_admin/mod_adhoc_cmd_admin.lua Sat Oct 10 03:24:41 2009 +0200 @@ -5,6 +5,7 @@ -- local st, jid, uuid = require "util.stanza", require "util.jid", require "util.uuid"; +local dataforms_new = require "util.dataforms".new; local usermanager_user_exists = require "core.usermanager".user_exists; local usermanager_create_user = require "core.usermanager".create_user; @@ -36,16 +37,13 @@ break; end end - local fields = {}; - for _, field in ipairs(form.tags) do - if field.name == "field" and field.attr.var then - for i, tag in ipairs(field.tags) do - if tag.name == "value" and #tag.tags == 0 then - fields[field.attr.var] = tag[1] or ""; - end - end - end - end + local layout = { + { name = "accountjid", type = "jid-single" }; + { name = "password", type = "text-private" }; + { name = "password-verify", type = "text-private" }; + }; + dataforms_new(layout); + local fields = layout:data(form); local username, host, resource = jid.split(fields.accountjid); if (fields.password == fields["password-verify"]) and username and host and host == stanza.attr.to then if usermanager_user_exists(username, host) then